i have an intermission script i made and it breaks because i’m trying to teleport the player to a spawn location
while wait() do
if inRound == true then
return
end
for i = 15, 0, -1 do
status.Value = "Time Left: "..i
wait(1.0)
end
intermissionSound:Stop()
for _, plr in pairs(game.Players:GetPlayers()) do
for _, spwn in pairs(workspace:WaitForChild("Map"):WaitForChild("PlayerSpawns"):GetChildren()) do
plr.Character.PrimaryPart.CFrame = spwn.CFrame
end
end
here is a piece of the code (it’s not the whole thing, most of it’s just clutter)
while true do
for index = 15, 0, -1 do
status.Value ="Time Left: " .. index
task.wait(1)
end
for _, player in pairs(game.Players:GetPlayers()) do
for _, spawn in pairs(workspace.Map.PlayerSpawns:GetChildren()) do
player.Character.HumanoidRootPart.CFrame = spawn.CFrame
end
end
end
What I should I written in my reply was you need to set the HumanoidRootPart’s CFrame to the spawn’s CFrame so the entire character teleports to the spawn.
do u want them to teleport in same spot?, in random spot?(may cause some of them to teleport in same spot) or them getting teleported to each spwn without causing them to overlap
local spwn = --put the spawn part
local function TeleportFunc()
for _, v in pairs(game.Players:GetChildren()) do
v.Character.Humanoid.Sit = false
v.Character:SetPrimaryPartCFrame(spwn.CFrame)
end
end
TeleportrFunc() -- use this to call the function when u intermission done
local lobby = workspace.Lobby
local map = game.ReplicatedStorage.Maps.Map
local status = workspace.Values.Status
local inRound = workspace.Values.InRound
local intermissionSound = game.SoundService['2D'].Intermission
local backgroundSound = game.SoundService['2D'].Background
intermissionSound:Play()
while wait() do
if inRound == true then
return
end
for i = 15, 0, -1 do
status.Value = "Time Left: "..i
wait(1.0)
end
intermissionSound:Stop()
for _, plr in pairs(game.Players:GetPlayers()) do
plr.Character:BreakJoints()
wait()
local swordClone = game.ReplicatedStorage.Tools.ClassicSword:Clone()
swordClone.Parent = plr.Backpack
end
local clone = map:Clone()
clone.Parent = workspace
inRound = true
lobby:Destroy()
local floorValue = workspace.Values.FloorValue
floorValue.Value = floorValue.Value + 1
local gui = game:GetService("StarterGui").UI.Intermission
gui.Enabled = false
local floorGui = game:GetService("StarterGui").UI.UI
floorGui.Enabled = true
backgroundSound:Play()
script.Enabled = false
end
thats what ive asked, if u want them to teleport in 1 spot, random spot(may cause to overlap character) or them having their own teleport target (but u need equal or more spwns than total players)
This might work for teleporting players to a random spawn
while true do
for index = 15, 0, -1 do
status.Value ="Time Left: " .. index
task.wait(1)
end
for _, player in pairs(game.Players:GetPlayers()) do
local spawns = workspace.Map.PlayerSpawns:GetChildren()
local randomSpawn = spawn[random.new(1, #randomSpawn)]
player.Character.HumanoidRootPart.CFrame = randomSpawn.CFrame
end
end
I am not too sure what else to provide but there are some youtube videos out there that show you how to make an intermission system possibly even a system that shows you how to teleport players as well?
local Spwns = workspace.Folder:GetChildren()
local function Teleport()
for i,v in pairs(game.Players:GetChildren()) do
v.Character.Humanoid.Sit = false
v.Character:SetPrimaryPartCFrame(Spwns[i].CFrame)
end
end
Teleport()