I'm trying to make a round system in one of my games and I've been having this problem for hours. Line 15 or "local char = player.Character" is what I'm having trouble with. It says "Character is not a valid member of SpawnLocation". Any ideas?
-- Round Variables
local roundLength = 300
local intermissionLength = 20
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local LobbySpawn = game.Workspace.LobbySpawn
local GameAreaSpawn = game.Workspace.GameAreaSpawn
InRound.Changed:Connect(function()
wait(1)
if InRound.Value == true then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = GameAreaSpawn.CFrame
end
else
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = LobbySpawn.CFrame
end
end
end)
local function roundTimer()
while wait() do
for i = intermissionLength, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
end
for i = roundLength, 1, -1 do
InRound.Value = true
wait(1)
Status.Value = "Game: ".. i .." seconds left !"
end
end
end
spawn(roundTimer)
