Still have questions? Join our Discord server and get real time help.
Log in to vote

Upgrade button is working, but points reset?

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

Answer this question