Is there any way to fix this script, it's basically a click to buy tycoon script. Working perfectly in studio, can't find the problem - i'm guessing it's something to do with the local player part?
local state = false
upgradecost = 999 --How much is the thing? Add it here.
function act()
state = not state
if state then
local cash = game.Players.LocalPlayer.leaderstats:findFirstChild("Coins") --Add your money type here.
if cash.Value > upgradecost then
cash.Value = cash.Value - upgradecost
script.Parent.Parent:remove()
end
end
end
script.Parent.ClickDetector.MouseClick:connect(act)

1 comment
Thanks a lot bro!! it worked ily