Hey, im making a clicker type game. And i have a GUI button and if i click on it it gives me Multiplier stat, Which multiplies my money gained per click.
This is my code!
local plr = game.Players.LocalPlayer local clicked = false local StarterGui = game.StarterGui script.Parent.Activated:Connect(function(begin) local Money = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Money") local Multiplier = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Multiplier") local upgradecost1 = game.Players.LocalPlayer.Upgradecost1
clicked = true
if clicked and Money.Value > (upgradecost1.Value) then
Multiplier.Value = Multiplier.Value +100
upgradecost1.Value = upgradecost1.Value *1.05
Money.Value = Money.Value -upgradecost1.Value
wait(.9)
clicked = false
end
end)
This is a child of a TextButton that is in a frame in a ScreenGUI in StarterGui,
I made it so whenever clicked it adds X amount of multipliers to my Multiplier.Value and the Upgradecost of the upgrade itself is a little more expensive every time. i have the Upgradecost as an StringValue in datastore ( to surpass the 9.22Qi limit). Now my Code works perfectly. But it stops working randomly after being clicked a couple of times and doesnt work Anymore. Eventhough i have enough Money.? I tried testing my game In the studio and On roblox itself still doesnt work.

1 comment
Please fix your code, half of your code is outside the codeblock