PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Player.OnTeleport

Player.OnTeleport

Oct 01 2018, 2:06 AM PST

This example prints which stage of a teleport a player is at, as well as printing if the teleport was a failure.

game.Players.PlayerAdded:Connect(function(player)
	local playerOnTeleport = player
	player.OnTeleport:Connect(function(teleportState, placeId, spawnName)
		if teleportState == Enum.TeleportState.Started then
			print("Teleport started ("..playerOnTeleport.Name..")")
		elseif teleportState == Enum.TeleportState.WaitingForServer then
			print("Teleport waiting for server ("..playerOnTeleport.Name..")")
		elseif teleportState == Enum.TeleportState.InProgress then
			print("Teleport in progress ("..playerOnTeleport.Name..")")
		elseif teleportState == Enum.TeleportState.Failed then
			print("Teleport failed! ("..playerOnTeleport.Name..")")
		end
	end)
end)