I want to make it for every 5 steps a player takes, they will gain XP.. but there will also be ways to gain things such as "+150 steps", but it won't reward them with 30 XP. I know that this is not the best way to do it, so I'm wondering what other ways I can do it.
I can always do something with the player's last checked step count but not sure.
s.Steps.Changed:connect(function() if s.Steps.Value/5 == math.floor(s.Steps.Value/5) then s.XP.Value = s.XP.Value+1 end end)
You just need to make a separate variable for the needed steps and the xp awarded.
neededsteps = 5 xpawarded = 1 s.Steps.Changed:Connect(function() -- connect is deprecated so use Connect if s.Steps.Value/neededsteps == math.floor(s.Steps.Value/neededsteps) then s.XP.Value = s.XP.Value+xpawarded neededsteps = neededsteps + 5 -- You could change how much this goes up or make a multiplier xpawarded = xpawarded + 1 -- same thing as above end end)