Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does this statAdder script not Add value to my Skips every 10 Stages completed[OBBY]?

I intended to make this script so that whenever you reach 10 Stages you get 1 Skips.

If you get 20 Stages you would have received 2 skips but you could use these up... so the math.floor(Stage.Value/10) would not work for this script.

What could i do ?

game.Players.PlayerAdded:connect(function(plr)
    local PlayerStats = plr:WaitForChild("PlayerStats")
    local Stage = PlayerStats:WaitForChild("Stage")
    local Skips = PlayerStats:WaitForChild("Skips")

Stage.Value.Changed:connect(function(plr)
	if Skips.Value == math.floor(Stage.Value/10) then
			Skips.Value = Skips.Value + 1
		end	
	end)
end)

1 answer

✓ Accepted answer

I would check to see if the stage value is a multiple of 10, and if it is, give the player a skip, like this:

if Stage.Value % 10 == 0 then
	Skips.Value = Skips.Value + 1
end

This discussion is preserved as it was. New answers, comments, and votes are closed.