I'm trying to make a teleport system to where players can 1v1 each other. Please help, thanks much! <3
local mat = script.Parent --model with all the parts and scripts
local TPStart1 = mat.TPStart1 --part which one player has to stand on to get teleported
local TPStart2 = mat.TPStart2 --part which another player has to stand on to get teleported
local TPEnd1 = mat.TPEnd1 --endpoint part of player on TPStart1
local TPEnd2 = mat.TPEnd2 --endpoint part of player on TPStart2
local bothReady = false
local TP1Ready = false
local TP2Ready = false
TPStart1.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid")
TP1Ready = true
if humanoid and bothReady then
local rootPart = humanoid.Parent:WaitForChild("HumanoidRootPart")
rootPart.CFrame = CFrame.new(TPEnd1.Position)
end
end)
TPStart2.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid")
TP1Ready = false
if humanoid and bothReady then
local rootPart = humanoid.Parent:WaitForChild("HumanoidRootPart")
rootPart.CFrame = CFrame.new(TPEnd2.Position)
end
end)
if TP1Ready and TP2Ready then
bothReady = true
end

2 comments
Are there any errors?
No