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

How do i make a script that when you touch a part you teleport to another part?

Asked by 6 years ago

Can someone help me? I made a script but its not working:

http://prnt.sc/gjebbn

0
You can copy and past the code into your question after hitting the blue lue button Worthy0ne 68 — 6y
0
I'm not good at it :P MajinBluee 80 — 6y
0
When you call the function, you can't feed it 3 perimeters if you only gave it one. R_alatch 394 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

Well i understand your question but then i looked at your screenshot and I didn't understand what you were doing so im just gonna tell you how to change the position of the player

well first you want to set a variable

local teleto = game.workspace.part -- that an example of where the part is located in game explorer

well now that that is done we need to get the actual teleporting done Assuming that the script is located within the part that teleports you this is how i would teleport the player

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild('humanoid') then
        hit.Parent.HumanoidRootPart.CFrame = CFrame.new(teleto.position)
    end
end)

0
Ahh i loke how you looked for the Humanoid to identify if the hit is a character, also CFrames are better too! Even though changeing position works too Worthy0ne 68 — 6y
0
Yes, use Dream's code am a' delete my ugly code ;-; Worthy0ne 68 — 6y
Ad

Answer this question