I'm making a clicker game, and I don't know how to make this shop function work. Basically, there is a textbutton that gives you a boost for each click, but you have to have 100 clicks for it. It does detect the 100 clicks, BUT, then I can press it over and over again, even if I am under 100 clicks. Can anyone help? Here's my current script:
local player = game.Players.LocalPlayer local clicks = player.leaderstats.Clicks function shop() script.Parent.Activated:Connect(function() if script.Parent.Activated then script.Parent.Activated:Connect(function() clicks.Value = clicks.Value - 100 script.Parent.Parent.click.Activated:Connect(function() clicks.Value = clicks.Value + 1 end) end) end end) end while true do wait() if clicks.Value >= 100 then break end shop() end
BTW: I am not asking for a whole new script, I just need to be guided in the right direction. Thank you!
local player = game.Players.LocalPlayer local clicks = player.leaderstats.Clicks script.Parent.MouseButton1Click:Connect(function() if clicks.Value >= 100 then clicks.Value = clicks.Value - 100 else clicks.Value = clicks.Value + clicks.Power.Value --make a Number value for this, and set it to 1, if you want it higher, just add to it end end)