Hello, I need help with my teleport script. The teleport script teleport you to a position.
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then hit.Parent.Head.CFrame = CFrame.new(--MY POSITION WANT TELLEPORTED--) end end)
It does work in all, but when I publish the game it wont teleport me. Please help!
If you can help please send me the script or send me the instructions
to how to fix it. Thanks
01 | script.Parent.Touched:Connect( function (hit) |
02 | if hit.Parent:FindFirstChild( 'Humanoid' ) then |
03 | local Players = game:GetService( "Players" ) |
04 | local TeleportService = game:GetService( "TeleportService" ) |
05 | local placeId = 0 -- replace here |
06 | local userId = 1 -- replace with player's userId |
07 | -- find the player |
08 | local player = Players:GetPlayerByUserId(userId) |
09 | -- teleport the player |
10 | TeleportService:Teleport(placeId, player) |
11 |
12 |
13 | end |
14 |
15 |
16 | end ) |
--Put this inside a part
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then hit.Parent:MoveTo(Vector3.new(0, 0, 0)) -- ADJUST HERE end end)