✓ Accepted answer
There are a few things wrong
First of all, if the game is Filtering Enabled then Local Scripts really can't affect leaderstats of any kind. Also, this obviously won't do anything because the script only runs once, and doesn't get updated. To update the script, you could use a Loop or the Changed event. I suggest the Changed event. I also suggest using a regular script, and getting the players with the PlayerAdded event.
Example,
game.Players.PlayerAdded:connect(function(plr)
local PlayerStats = plr:WaitForChild("PlayerStats")
local Stage = PlayerStats:WaitForChild("Stage")
local Skips = PlayerStats:WaitForChild("Skips")
Stage.Changed:connect(function()
if Stage.Value >= 10 then
Skips.Value = 1
elseif Stage.Value >= 20 then
Skips.Value = 2
end
end)
end)
You also made a typo after the elseif
Doing the math
All we have to do is divide Stage by 10 and use the math.floor function to round it down.
game.Players.PlayerAdded:connect(function(plr)
local PlayerStats = plr:WaitForChild("PlayerStats")
local Stage = PlayerStats:WaitForChild("Stage")
local Skips = PlayerStats:WaitForChild("Skips")
Stage.Changed:connect(function()
Skips.Value = math.floor(Stage.Value/10)
end)
end)
Fixed typo
Let me know if you have any problems, or if the script isn't working for you.
Good Luck!
If I helped, please don't forget to accept my answer.
1 comment
Well the first one doesn't work either for some reason so it can't be that and i want it to be coded so every 10 Stages you gain 1 Skip so it would be 10,20,30,40,50,60,70,80,90,100 1,2,3,4,5,6,7,8,9,10