Hello! Does anyone know how I can detect if a player is flying or teleporting in my game? I’ve been looking for information in the docs but I can’t find much about it.
What i need to do
I would like to be able to detect the player who flies (if he is not an admin) and show a warn() in the output, and if the player teleports by clicking, how can he detect it?
For teleporting you can check once a second how far the player has moved if they moved too much then they have teleported as for flying, you would likely need to check if a player is in the falling humanoid state for a long period of time.
Would it be something like this? I’m not sure how to set the variables properly…
local function check_PlayerPosition(currentPosition)
local current = currentPosition
local changePosition = current -- i am not sure what to do here...
if(current - changePosition) then
warn('You are teleporting! warning')
else
print('The player is not teleporting, it is normal')
end
end
game.Players.PlayerAdded:Connect(function(player)
check_PlayerPosition(player.Position) -- Function called
end)