Log in to vote

Upgrade button is working, but points reset?

Asked by 10 days ago
Edited 10 days ago

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

    if Currency.Value >= cost then
        Currency.Value = Currency.Value -cost
        cps.Value = cps.Value +added
       script.Parent.Text = "Purchased!"
        script.Parent.Text = txt
    elseif Currency.Value < cost then
        script.Parent.Text = "Not enough DP!"
        script.Parent.Text = txt

Local Script

Uh the script was supposed to do that? incapaz 5465 — 10d
Are you sure that the problem is because of the Script... AIphanium 110 — 10d
I'm SURE it has to do something with FilteringEnabled, because it prevents cheaters from increasing their points on the leaderboard. AIphanium 110 — 10d
If it is on, then you have to do stuff with RemoteEvent/Functions. AIphanium 110 — 10d
View all comments (4 more)
Or, you could use the simple way, and turn it off, which i may not recommend. AIphanium 110 — 10d
FE cannot be turned off, so why are you giving OP nonexistent methods? incapaz 5465 — 10d
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 RegisteredCode 168 — 10d
Agreed, add a remote event in SSS that picks up the event upon firing from the local client side script ABK2017 175 — 10d

Answer this question