My Current Code:
function onTouched(hit)
--code to teleport players to a specific location
if Teleport = true do
player.Character:MoveTo(Vector3.new(0,200,0))
end
end
script.Parent.Touched:connect(onTouched)
this script is parented to a brick, so what i'm trying to do is make a teleport brick that when the variable teleport is true, people can teleport to the main game and play, but I keep getting errors in all my attempts, also is there a way you can share variables across scripts for setting Teleport to true when the round has ended? Thanks
also teleport your player, not all players
Answered by Internal_1 :
script.Parent.Touched:Connect(function(p)
player = game.Players:GetPlayerFromCharacter(p.Parent)
if player and Teleport then
player.Character:MoveTo(Vector3.new(0,200,0))
end
end)

1 comment
wut is the error saying