I'm trying to make tear gas, or smoke grenade or something, idk, but it will work when using greater than or equal to, but not less than or equal to. And I want it so when they're 5 studs are closer, they are damaged.
local function damagePlr()
player.Character.Humanoid.Health=player.Character.Humanoid.Health-10
end
local mag=(player.Character:GetModelCFrame().p-toxicC.Position).magnitude
--
while mag<=5 do
damagePlr()
wait(3)
end
--

4 comments
It's probably cause when you use mag >= 5, mag is probably greater than 5, like 6 or 7. You could add a print() before the while mag <= 5 do having print(mag) or something like that to see if mag is actually <= 5
Based on your question, I think I know the answer.The character's position doesn't update, so it gets the characters position based on where it was first. I am not on mobile, so I csnt test it yet.
Based on your comment*, can't*
Yeah that might be the problem. Put the local mag inside a loop