Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My teleport won't work when I publish my game but it works when I test it in studio? (Please Help)

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

1 comment

0

I would suggest changing the CFrame of the HumanoidRootPart to teleport.

2 answers

script.Parent.Touched:Connect(function(hit)
 if hit.Parent:FindFirstChild('Humanoid') then 
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local placeId = 0 -- replace here
local userId = 1 -- replace with player's userId
-- find the player
local player = Players:GetPlayerByUserId(userId)
-- teleport the player
TeleportService:Teleport(placeId, player)


end 


end)

1 comment

0

He didn't mean an actual teleport, I think he meant to position the character.

--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)

This discussion is preserved as it was. New answers, comments, and votes are closed.