Pcalls for teleportation

Hi, devforum. How can i turn the teleportation line of this code into a pcall? I need to make sure the player gets teleported. I’m very new to pcalls.

local players = game:GetService("Players")
local tps = game:GetService("TeleportService")
local prefix = "/"

players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		if msg == prefix.."campaign" then
			tps:Teleport(17580142383, plr)
		end
	end)
end)

Yes you can. Just make it loop until it succeeds.

local success

repeat 
  success, result = pcall(tps.Teleport, tps, 17580142383, plr)
  task.wait()
until success
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.