So I wrote a Server Script
to teleport ALL
players to a position when the intermission is up.
I thought I could use a for loop
to teleport them all but it doesn't seem to be working.
I'll explain with comments in the code block below..
local players = game.Players:GetChildren() local roundRunning = false local Intermission = true if Intermission == true then local intermissionHint = Instance.new("Hint", workspace) for i = 30, 0, -1 do intermissionHint.Text = "Intermission: "..i wait(1) if i == 0 then wait(1) intermissionHint:Destroy() Intermission = false roundRunning = true end end end if roundRunning == true then for i,v in pairs(players) do -- SO eh here. Yeah. --[[ So as you can see here I tried to teleport all players in the server here. ]]-- v.Character.HumanoidRootPart.CFrame = CFrame.new(23.09, 11.473, 8.84) end end
Anyone got any idea why this isn't working??
Personally, I would use a pre-determined function in collaboration with your Intermission If Statement.
local players = game.Players:GetChildren() local roundRunning = false local Intermission = true function teleportPlayers() for i,v in pairs(players) do HRP = v.Character.HumanoidRootPart HRP.CFrame = CFrame.new(23.09, 11.473, 8.84) end end if Intermission == true then local intermissionHint = Instance.new("Hint", workspace) for i = 30, 0, -1 do intermissionHint.Text = "Intermission: "..i wait(1) if i == 0 then wait(1) intermissionHint:Destroy() Intermission = false roundRunning = true teleportPlayers() end end end