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

8 comments
Uh the script was supposed to do that?
Are you sure that the problem is because of the Script...
I'm SURE it has to do something with FilteringEnabled, because it prevents cheaters from increasing their points on the leaderboard.
If it is on, then you have to do stuff with RemoteEvent/Functions.
Or, you could use the simple way, and turn it off, which i may not recommend.
FE cannot be turned off, so why are you giving OP nonexistent methods?
Use a RemoteEvent to change the user's currency. Right now you're changing it on the client, using a RE you'll be changing it on the server, meaning the points won't go back to their previous value either. Had the same problem a while back, this fixed it
Agreed, add a remote event in SSS that picks up the event upon firing from the local client side script