ScripterYowai

Mega mansion tycoon

Apr 27th, 2024
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | None | 0 0
  1. local VirtualUser=game:service'VirtualUser'
  2. game:service'Players'.LocalPlayer.Idled:connect(function()
  3. VirtualUser:CaptureController()
  4. VirtualUser:ClickButton2(Vector2.new())
  5. end)
  6.  
  7. local tycoons = game:GetService("Workspace")["Zednov's Tycoon Kit"].Tycoons;
  8. local players = game:GetService("Players");
  9. local player = players.LocalPlayer;
  10. local character = player.Character;
  11. local tycoon = nil;
  12. getgenv().run = false;
  13. wait(0.5);
  14. getgenv().run = true;
  15.  
  16. local get_by_path = function(root_obj,path_string)
  17. if(not root_obj) then
  18. wait(1);
  19. return nil;
  20. end
  21. for part in string.gmatch(path_string,"[^%.]+") do
  22. local found = nil;
  23. if(type(root_obj) == 'table' and root_obj[part] ~= nil) then
  24. found = root_obj[part];
  25. else
  26. found = root_obj:FindFirstChild(part);
  27. if(found) then
  28. else
  29. return nil;
  30. end
  31. end
  32. if(found) then root_obj = found; end
  33. end
  34. return root_obj;
  35. end
  36. while wait() and tycoon == nil and getgenv().run == true do
  37. for _,loop_tycoon in pairs(tycoons:GetChildren()) do
  38. if(loop_tycoon.ClassName == "Model" and loop_tycoon.Owner.Value == player) then
  39. tycoon = loop_tycoon;
  40. end
  41. end
  42. end
  43. if(tycoon == nil) then return; end
  44. while wait() and getgenv().run == true do
  45. local giver = get_by_path(tycoon,"Essentials.Giver");
  46. if(giver == nil) then
  47. giver = get_by_path(tycoon,"PurchasedObjects.Level2.level1finished.Giver");
  48. end
  49. if(giver == nil) then
  50. local models = get_by_path(game:GetService("Workspace"),"ClientApartmentObjects.Level3Start.phStart");
  51. if(models == nil) then continue; end
  52. for _,model in pairs(models:GetChildren()) do
  53. if(model.ClassName == "Model") then
  54. for _,part in pairs(model:GetChildren()) do
  55. if(get_by_path(part,"TouchInterest")) then
  56. giver = part;
  57. end
  58. end
  59. end
  60. end
  61. end
  62. if(giver == nil) then continue; end
  63. firetouchinterest(character.LeftFoot,giver,0);
  64. wait(0.1);
  65. firetouchinterest(character.LeftFoot,giver,1);
  66. wait(0.1);
  67. local cheapest = nil;
  68. local cheapest_price = nil;
  69. local levels = tycoon.Buttons:GetChildren();
  70. table.insert(levels,game:GetService("Workspace").ClientButtons);
  71. for _,level in pairs(levels) do
  72. for i,button in pairs(level:GetChildren()) do
  73. if(
  74. button:FindFirstChild("extra") ~= nil and
  75. get_by_path(button,"Head.TouchInterest") ~= nil and
  76. button.extra.Transparency <= 0
  77. ) then
  78. local price = nil;
  79. if(get_by_path(button,"BillboardGui.Frame.ImageLabel.PriceText2") ~= nil) then
  80. price = nil;
  81. elseif(get_by_path(button,"Price") ~= nil) then
  82. price = button.Price.Value;
  83. elseif(get_by_path(button,"BillboardGui.Frame.ImageLabel.PriceText") ~= nil) then
  84. local price_string = get_by_path(button,"BillboardGui.Frame.ImageLabel.PriceText").Text
  85. local mult = price_string:sub(-1);
  86. if(mult == "K") then
  87. price = tonumber(price_string:sub(2,-2)) * 1000;
  88. elseif(mult == "M") then
  89. price = tonumber(price_string:sub(2,-2)) * 1000 * 1000;
  90. else
  91. price = tonumber(get_by_path(button,"BillboardGui.Frame.ImageLabel.PriceText").Text);
  92. end
  93. end
  94. if(price ~= nil) then
  95. if(cheapest == nil) then
  96. cheapest = button;
  97. cheapest_price = price;
  98. elseif(price < cheapest_price) then
  99. cheapest = button;
  100. cheapest_price = price;
  101. end
  102. end
  103. end
  104. end
  105. end
  106. if(
  107. get_by_path(cheapest,"Head") ~= nil and
  108. cheapest_price < player.leaderstats.Cash.Value
  109. ) then
  110. firetouchinterest(character.LeftFoot,cheapest.Head,0);
  111. wait(0.1);
  112. if(get_by_path(cheapest,"Head") ~= nil) then
  113. firetouchinterest(character.LeftFoot,cheapest.Head,1);
  114. wait(0.1);
  115. end
  116. player.PlayerGui.UI.Store.Visible = false;
  117. end
  118. end
Add Comment
Please, Sign In to add comment