Here Is My Attempt, I tried Several Times Cannot Find a Way
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Status = ReplicatedStorage:WaitForChild("Status") local GameInProgress = ReplicatedStorage:WaitForChild("GameInProgress") local Lobby = workspace.Lobby game.Players.PlayerAdded:Connect(function(Player) if GameInProgress == true then Player.Character.HumanoidRootPart.CFrame = CFrame.new() end end)
I would do something along the lines of defining the spawns model first
local Spawns = yourSpawnsModelPath:GetChildren();
then I would create a function to get the randomspawn
function getRandomSpawn() local ranNum = math.random(1,#Spawns); local Spawn = Spawns[ranNum]; return Spawn; end
Then I will create a function to teleport the player to the random spawn
function teleportPlayerToSpawn(player) --Check to see if the player exist if game.Players:FindFirstChild(player) then --defining the character local char = plr.Character or plr.CharacterAdded:Wait() --grabbing the part you want to teleport usually the hrp local hrp = char:WaitForChild("HumanoidRootPart") -- making sure it exist if hrp then -- making sure the randomspawn exist if getRandomSpawn() then -- changing the players position to the random spawn hrp.CFrame = getRandomSpawn().CFrame * CFrame.new(0,3,0) end end end end
Then call the function when needed teleportPlayerToSpawn(player)
dont forget the player variable pass through the player object.
I am not 100% sure this work neither if it's the best method made it off the spot hope it works! Upvote if it helps! -cc