"Invalid Player to Teleport"

I ran into a problem just now when I tried to teleport from one place to another. Both places are within the same game, so I put in this simple code.

script.Parent.Touched:Connect(function()
	game:GetService('TeleportService'):Teleport(9734736405)
end)

Instead of teleporting I got this message in output:

InvalidPlayer

To specify just in case, it is a private game, and I’m trying to teleport from one place to starting place.

thanks

1 Like
script.Parent.Touched:Connect(function(obj)
	game:GetService('TeleportService'):Teleport(9734736405,obj)
end)

define the player who touched it

1 Like

No, it still doesn’t work
(30Char)

You need to pass a player as the second argument to :Teleport().

script.Parent.Touched:Connect(function(Hit)
  if Hit.Parent:FindFirstChild("Humanoid") then 
    local Player = game.Players:GetPlayerFromCharacter(Hit.Parent) 
    TeleportService:Teleport(9734736405, Player)
  end
end)
2 Likes

@OppaStoppaStomppa
Thank you! Sorry for lengthy response.

2 Likes