This works perfectly for rewarding the player when "Stage" is a multiple of 5, but the issue I've run into is that if a player is on stage 5 and continually reloads they'll keep being rewarded. is there a way i can make this function only applicable when changing, and not during initial "creation", or being pulled from the DataStore.

	game.Players.PlayerAdded:Connect(function(plr)
	    local Leaderstats = plr:WaitForChild("leaderstats")
	    local Stage = Leaderstats:WaitForChild("Stage")
	    local Gems = plr:WaitForChild("Gems")
	    local Skips = plr:WaitForChild("Skips")
	 
	    Stage.Changed:Connect(function(new)
	        if new % 5 == 0 then
	            Gems.Value = Gems.Value + 10
	        end
	    end)

	end)

5 comments

0

Could you explain it a little better?

0

Instead of having a separate script do it all from one script. If that's your only script then a separate script is creating the leaderstats.

0

Okay let me merge together my Datastore script and this script, ill see if that works.

0

You're scary good at this inca. Problem is now resolved, but how was having them in different locations causing the issue?

0

Also please send an answer so i can mark it :) Thanks!!!