Hi, Im trying to get my teleporting script working and it's saying there's a problem but I don't know what it is. sorry I'm really new at coding Lua
local Teleport1A = script.Parent
local Teleport1B = script.Parent.Teleport1B
local canTeleport = true
function TeleportA(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 TeleportB(part)
local hum = part.Parent:FindFirstChild
("HumanoidRootPart")
if hum then
canTeleport = false
hum.CFrame = Teleport1A.CFrame + Vector3.
new(0,5,0)
wait(5)
canTeleport = true
end
end
end
Teleport1A.Touched:Connect(TeleportA)
Teleport1B.Touched:Connect(TeleportB)

1 comment
Thanks What was wrong with my code before? was the spacing wrong?