Hi i’m doing a round script but somehow my script just simply doesn’t want to run these lines of code :
game.Workspace.CurrentlyLoaded:ClearAllChildren()
for i, player in pairs(Players:GetChildren()) do
local char = player.Character
char.Humanoid.BreakJointsOnDeath = false
char.Humanoid.Health = 0
end
for i, player in pairs(Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = LobbySpawn.CFrame
end
end
spawn(roundTimer)
entire script :
local Players = game.Players
local intermisionLegnth = 30
local choosingMapLength = 15
local InRound = game.ReplicatedStorage.InGame
local LobbySpawn = game.Workspace.Lobby.LobbySpawn
local Status = game.ReplicatedStorage.Status
local ChoosingMap = game.ReplicatedStorage.ChoosingMap
local RoundSpawn = game.Workspace.Lobby.LobbySpawn
local minutes = 0
local seconds = 5
local mapChosen = game.ServerStorage["_Colorful Warehouse"]
local function roundTimer()
while true do
for i = intermisionLegnth, 0, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission ("..i..")"
end
ChoosingMap.Value = true
for i = choosingMapLength, 0, -1 do
wait(1)
Status.Value = "Choosing map... ("..i..")"
end
Status.Value = "Loading map ..."
wait(0.5)
Status.Value = "Loading map .."
wait(0.5)
Status.Value = "Loading map ."
wait(0.5)
Status.Value = "Loading map"
wait(0.5)
Status.Value = "Loaded"
wait(0.5)
InRound.Value = true
ChoosingMap.Value = false
local pos = {Vector3.new(0,0,0),Vector3.new(0,0,200),Vector3.new(0,0,400),Vector3.new(0,0,600),Vector3.new(0,0,800),Vector3.new(0,0,1000),Vector3.new(0,0,1200),Vector3.new(0,0,1400),Vector3.new(0,0,1600),Vector3.new(0,0,1800),Vector3.new(0,0,2000),Vector3.new(0,0,2200),Vector3.new(0,0,2400),Vector3.new(0,0,2600),Vector3.new(0,0,2800),Vector3.new(0,0,3000),Vector3.new(0,0,3200),Vector3.new(0,0,3400),Vector3.new(0,0,3600),Vector3.new(0,0,3800)}
for i, player in pairs(Players:GetChildren())do
local clone = mapChosen:Clone()
clone.Parent = game.Workspace.CurrentlyLoaded
clone:MoveTo(pos[i])
print("Initiated map"..mapChosen.Name..i)
local char = player.Character
char.HumanoidRootPart.CFrame = clone:WaitForChild("Spawn").CFrame
end
repeat
if seconds <= 0 then
minutes = minutes - 1
seconds = 59
else
seconds = seconds - 1
end
if seconds <= 9 then
Status.Value = tostring(minutes)..":0"..tostring(seconds)
else
Status.Value = tostring(minutes)..":"..tostring(seconds)
end
wait(1)
until minutes <= 0 and seconds <= 0
minutes = 0
seconds = 5
end
game.Workspace.CurrentlyLoaded:ClearAllChildren()
for i, player in pairs(Players:GetChildren()) do
local char = player.Character
char.Humanoid.BreakJointsOnDeath = false
char.Humanoid.Health = 0
end
for i, player in pairs(Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = LobbySpawn.CFrame
end
end
spawn(roundTimer)
I get no errors in the output, and i’m sure that the variables, everything are correct, also i’m almost sure that no scripts interfere with this one, i’m not using breakpoints and i’d like some help because i’ve been trying to figure this out for the past 3 hours but I can’t find why
(maybe cuz i’m a beginner lol)
If you need more infos to solve this problem, ask me in the replies, thanks !
Game link so you can see for yourself the problem: Atmos [Indev] - Roblox
oh also it’s normal that a round only lasts for 5 seconds, it’s for testing purposes and to make it faster