Just wanting to know how I can make a tycoon button or circle to build the item its meant to build and how to get it to read the amount of money needed to be spent on that build.
COMMUNITY QUESTION
What scripting would I use to make a tycoon button and to check if you have enough money?
1 answer
You can detect the player's money value, if it's higher than the requirement, set the money value to money value minus the price.
Heres an example. You must use LocalScript for this! Make sure you put the script in StarterGui.
script.Parent = game:GetService("StarterGui") -- For safety purposes, I set it to you
local button = game.Workspace.Button1
local requirementmoney = 100
button.Touched:Connect(function()
if game:GetService("Players").LocalPlayer:WaitForChild("leaderstats").Money.Value > requirementmoney - 1 then
game:GetService("Players").LocalPlayer:WaitForChild("leaderstats").Money.Value = game:GetService("Players").LocalPlayer:WaitForChild("leaderstats").Money.Value - requirementmoney
button:Destroy()
else
print("Not enough money! ".. requirementmoney - game:GetService("Players").LocalPlayer:WaitForChild("leaderstats").Money.Value .." money is needed to purchase."
end
end)
This is just an example, the Instances and Values' locations are needed to set on your own.
NOTE: Not all LocalScript will work in workspace.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
If you really wanna use a Localscript to set the Money of the User you're either a Noob or outdated by 4 Years.
What do you mean? I think I meant like he said? So what do you need then.
You also can use a script, but I wouldn't recommend. My way works either if there's no errors...