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

Problem with setting leaderstats to 0? IDK why, problem persists long time now.

Asked by
NorteX_tv 101
5 years ago
Edited 5 years ago

I am doing a LocalScript to Script RemoteEvent and everything works PERFECTO!! Absolutely no problems, works as intended.

BUT! Of course, there is a problem that Roblox served me. When I set leaderstat value (for example Cash value) to a number above 0 (for example 123) it works well.

When I try to set it as 0 or nil it doesn't work. It doesn't work anyway. I copied the script from the working one and the ONLY thing I changed was to change 123 to 0.

IT DOESN'T WORK when it's set to 0, works if set to any number other than 0.

WHAT CAN BE THE CASE? Here is the code, you asked for it:

LocalScript:

game.ReplicatedStorage.SETCASH:FireServer()

Script:

game.ReplicatedStorage.SETCASH.OnServerEvent:Connect(function(plr)
    plr.leaderstats.Cash.Value = 0
end)

and, to the point it's plr.leaderstats.Cash.Value = 1 or more it works nice. Except for 0 (like in code)

Also, I made sure to include all necessary RemoteEvents in RemoteStorage.

Also, I tried doing this some time ago and it was the same result, still isn't fixing, so it shouldn't be a temporary bug.

0
u have to show us the code.. Imperialy 149 — 5y
0
Never do we have to ask you for code. That's already "yes". User#24403 69 — 5y
0
But, you don't know, it all does work, and only thing I did was copying same scripts and replacing number with 0 and still everything worked except setting to 0... But fine, I will edit this question with the code. NorteX_tv 101 — 5y
0
Okay code is now in question. Still awaiting answer tho... NorteX_tv 101 — 5y

Answer this question