✓ Accepted answer
Just wrote a little code to do what you ask. Though its tested with more than 2 players it will only teleport 2 players at a time. I haven't tested it for projectiles or other things that are not players. But it should be ok.
Code: (Added comments explaining what does what, hope its good enough! lol)
local teleportpart = script.Parent
local Player1 = nil
local Player2 = nil
local LastPlayerHit = nil
local Disabled = false
teleportpart.Touched:Connect(function(hit)
local Char = hit.Parent
local IsPlayer = (function(c)
local bisPlayer = game.Players:GetPlayerFromCharacter(c)
local Human = c:FindFirstChild("Humanoid")
return (bisPlayer ~= nil and Human ~= nil)
end)(Char)
if(Disabled == false) then
if(Char ~= LastPlayerHit and Char ~= Player1 and Char ~= Player2 and IsPlayer == true) then
LastPlayerHit = hit.Parent
if(Player1 == nil) then
Player1 = Char
elseif(Player2 == nil) then
Player2 = Char
end
end
if(Player1 ~= nil and Player2 ~= nil) then
local Player1_HRP = Player1:FindFirstChild("HumanoidRootPart")
local Player2_HRP = Player2:FindFirstChild("HumanoidRootPart")
if(Player1_HRP ~= nil and Player2_HRP ~= nil) then
Player1_HRP.Position = Vector3.new(math.random(-20,-5),0,math.random(23,45))
Player2_HRP.Position = Vector3.new(math.random(-20,-5),0,math.random(23,45))
Player1 = nil
Player2 = nil
LastPlayerHit = nil
Disabled = true
wait(1)
Disabled = false
else
Player1 = nil
Player2 = nil
LastPlayerHit = nil
Disabled = true
wait()
Disabled = false
end
end
end
end)
Hope this helps! :)
2 comments
Life Saver! By timer do you mean wait()?
kinda. i was thinking of a cool down that you could make when only one player touched the teleport to reset it. Lets say only 1 player touched it then walks away, For about 5 mins no-one else touches the teleport. I think the teleport should have a reset so then the next player or two count. And the tport has forgotten the first player.