i'm currently making a Away-From-Keyboard plugin but i need to check if the player moves. i made this loop:
btw the X and Y and Z are coordinates that are put in once the player uses /afk
I also used:
	
	
	
	
   PlayerMoved = 0
	repeat
		if not( X == Player:GetPosX() ) and ( Y == Player:GetPosY() ) and ( Z == Player:GetPosZ()) then
			PlayerMoved = 1
			Player:SetName( Name[Player:GetName()] )
			Server:SendMessage( Player:GetColor() .. Player:GetName() .. cChatColor.White .. " is back")
		end
		LOG("TEST")
	until PlayerMoved == 1
but once it starts it never stops. even if i walk. and it kind of destroys the server becouse the server is only working on the loop. does anyone know how to fix it?btw the X and Y and Z are coordinates that are put in once the player uses /afk
I also used:
while not( X == Player:GetPosX() ) and ( Y == Player:GetPosY() ) and ( Z == Player:GetPosZ()) do Player:SetName( Name[Player:GetName()] ) Server:SendMessage( Player:GetColor() .. Player:GetName() .. cChatColor.White .. " is back") end

 

 


 You must let the server update the player positions first by returning in your function
 You must let the server update the player positions first by returning in your function
	
