I made a anti-cheat, but whenever a player get kicked the loop break.
run = coroutine.create(function()
while wait(.1) do
for i,arunning in pairs(humrunning) do
plr = game.Players[tostring(arunning)]
if plr then
if plr.data.stat.actualsta.Value > 0 then
plr.data.stat.rstat.agi.Value += 0.005 * expboost
plr.data.stat.rstat.melee.Value += 0.0005 * expboost
plr.Character.Humanoid.WalkSpeed = (plr.data.stat.rstat.agi.Value/20) + (plr.data.stat.rstat.melee.Value/50) + (plr.data.stat.rstat.dagger.Value/20) +(plr.data.stat.rstat.magic.Value/50) + 20
else
plr.Character.Humanoid.WalkSpeed = 16
plr.data.stat.actualsta.Value = 0
plr.data.isrunning.Value = false
end
end
end
end
end)
(server side script) i dont know how i can fix this. Pls help.

3 comments
Use
FindFirstChild(tostring(arunning))instead of[tostring(arunning)]since indexing will throw an error if player does not exist, also check for plr.Character and plr.Character.Humanoid not being nil, that can also throw an error.If the player leaves or gets kicked from the game, remove their name from the table: it solves your problem and reduces potential memory leaks
Ty imKirda. No more errors!