I would like to create a ROBLOX Mimic-like teleport feature (that teleports all players in server to a reserved server when they touch a certain part [when the player has reached the end of part 1, they get to part 2])
The problem is that if two servers are on part 1, and both reach part 2, they will meet eachother and possibly (high chance) crash/break the game.
I’m stuck, even after getting help on reserved teleporting, and I cannot find any solutions.
Anything would help, thanks!
Code:
local TeleportService = game:GetService('TeleportService')
local players = game:GetService("Players")
local part2GameId = 0
script.Parent.Touched:Connect(function(otherPart)
if otherPart.Parent:FindFirstChildWhichIsA("Humanoid") then
local player = players:GetPlayerFromCharacter(otherPart.Parent)
local success, result = pcall(function()
return TeleportService:TeleportPartyAsync(part2GameId, players:GetChildren())
end)
if not success then
warn(result)
end
end
end)