Hello, I want to make a clicker game and I made an upgrade button but when I click it the upgrade works fine, but when I click on the Points Giver Image the points reset.Like, I have 135 points.Then when I click on the upgrade button I have 35.After I click on Points Giver Image it goes back to 135.Can someone help me??? Code:
local Player = game:GetService("Players").LocalPlayer local leaderstats = Player:WaitForChild("leaderstats") local Currency = leaderstats:WaitForChild("DP") local stats = Player:WaitForChild("Stats") local cps = stats:WaitForChild("CPS") local cost = 100 local added = 1 local txt = script.Parent.Text script.Parent.MouseButton1Click:Connect(function() if Currency.Value >= cost then Currency.Value = Currency.Value -cost cps.Value = cps.Value +added script.Parent.Text = "Purchased!" wait(1) script.Parent.Text = txt elseif Currency.Value < cost then script.Parent.Text = "Not enough DP!" wait(1) script.Parent.Text = txt end end)
Local Script