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

Teleport Script is not working? so i got a book and all scripts were working but not this

Teleport Script

Teleport Script: ``

 local Teleport1A = script.Parent
 local Teleport1B = script.Parent.Teleport1B

local canTeleport = true
function Teleport1A(part)
 	local hum = part.Parent:FindFirstChild("HumanoidRootPart")
 	if hum then
 		if canTeleport then
 			canTeleport = false
 			hum.CFrame = Teleport1B.CFrame + Vector3.new(0,5,0)
 	          	wait(5)
			canTeleport = true
		end
 	end	
 end

 function Teleport1B(part)
	local hum = part.Parent:FindFirstChild("HumanoidRootPart")
 	if hum then
 		if canTeleport then
			canTeleport = false
			hum.CFrame = Teleport1A.CFrame + Vector3.new(0,5,0)
			wait(5)
			canTeleport = true
 		end
	end
 end


Teleport1A.Touched:connect(Teleport1A)
Teleport1B.Touched:connect(Teleport1B)

`> `

Teleport1A.Touched:connect(Teleport1A) Teleport1B.Touched:connect(Teleport1B)

>

1 answer

Well, I would like you to use MoveTo instead of Vector3. If the script doesn't work, double check the directories of the part and then also not working, try changing the name of both the functions.

 local Teleport1A = script.Parent
 local Teleport1B = script.Parent.Teleport1B

local canTeleport = true
function Teleport1A(part)
    local hum = part.Parent
    if hum then
        if canTeleport then
            canTeleport = false
            hum:MoveTo(Teleport1B.Position) -- Moves the player's position to Teleport1B's position
                wait(5)
            canTeleport = true
        end
    end 
 end

 function Teleport1B(part)
    local hum = part.Parent
    if hum then
        if canTeleport then
            canTeleport = false
            hum:MoveTo(Teleport1A.Position)
            wait(5)
            canTeleport = true
        end
    end
 end


Teleport1A.Touched:Connect(Teleport1A) -- Capital 'C'
Teleport1B.Touched:Connect(Teleport1B) -- Capital 'C'

Lemme know if it helps!

19 comments

0

If Teleport1A and Teleport1B is a model, use hum:MoveTo(Teleport1A.PrimaryPart.Position) and then go to explorer, select the model and go to properties. Then, click on PrimaryPart and then on explorer, click the part taht is the centre of the model.

0

oh.. model!

0

WHATS directories?

0

Directories here means where the part is located in explorer

0

and the name of the functions and the name of the parts

0

If it still doesn't work, DM me in discord Samyak#7649

0

local Teleport = "Part2" function Touch(hit) if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true local Pos = script.Parent.Parent:findFirstChild(Teleport) hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFi

0

how to check directories?

0

Do you have discord?

0

Or can you add Team Create o that I can see what the real issue is

0

yeah i have discord

0

and its a test game not an actual game

0

i made it team create. what do i do next?

0

Samyak#7649 is my discord DM me there

0

It will be easier for me to provide help to you in realtime

0

ok at 6:00 pm IST

0

i reqested you on discord

0

https://discord.gg/xvbctS for @BestCreativeBoy 

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