Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Upgrade button is working, but points reset?

Asked by 5 years ago
Edited 5 years 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


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

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

Answer this question