Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
ZeeBaine -15
5 years ago

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

0
I would suggest changing the CFrame of the HumanoidRootPart to teleport. EmK530 143 — 5y

2 answers

Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
5 years ago
01script.Parent.Touched:Connect(function(hit)
02 if hit.Parent:FindFirstChild('Humanoid') then
03local Players = game:GetService("Players")
04local TeleportService = game:GetService("TeleportService")
05local placeId = 0 -- replace here
06local userId = 1 -- replace with player's userId
07-- find the player
08local player = Players:GetPlayerByUserId(userId)
09-- teleport the player
10TeleportService:Teleport(placeId, player)
11 
12 
13end
14 
15 
16end)
0
He didn't mean an actual teleport, I think he meant to position the character. Infocus 144 — 5y
Ad
Log in to vote
0
Answered by
Infocus 144
5 years ago

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

Answer this question