local serverstorage = game:GetService("ServerStorage") local debris = game:GetService("Debris") local roundtimer = 60*5 local intermissiontime = 60 --*whatever amount of minutes if any are neededs local replicatedstorage = game:GetService("ReplicatedStorage") local event = replicatedstorage:WaitForChild("RemoteEvent") local maps = serverstorage:WaitForChild("Maps") local mapholder = game.Workspace:WaitForChild("MapHolder") local map = mapholder:GetChildren() while true do --wait for contestants while true do wait(5) contestants = {} for _, player in pairs(game.Players:GetPlayers()) do if player and player.Character then local humanoid = player.Character:WaitForChild("Humanoid") if humanoid and humanoid.Health > 0 then table.insert(contestants, player) end end end if #contestants >= 2 then print("Enough players detected! Starting game soon.") break else print("Not enough players.") end end --load a random map wait(2) mapholder:ClearAllChildren() wait(2) local allmaps = maps:GetChildren() local newmap = allmaps[math.random(1,#allmaps)]:clone() newmap.Parent = game.Workspace.MapHolder wait(2) --teleport players local spawnsmodel = newmap:WaitForChild("Spawns") local spawns = spawnsmodel:GetChildren() for _, player in pairs(contestants) do if player and player.Character and #spawns > 0 then local torso = player.Character:WaitForChild("Torso") spawnindex = math.random(1,#spawns) local spawn = spawns[math.random(1,#spawns)] if spawn and torso then table.remove(spawns,spawnindex) torso.CFrame = CFrame.new(spawn.Position + Vector3.new(0,3,0)) local tag = Instance.new("StringValue") tag.Name = "tag" tag.Parent = player.Character end end end spawnsmodel:remove() --wait for round end conditions k? --ye sure m8 --kthx --np local localtimer = roundtimer while localtimer > 0 do wait(1) localtimer = localtimer-1 activecontestants = {} for _, player in pairs(contestants) do if player then local character = player.Character if character then local tag = character:FindFirstChild("tag") local humanoid = character:FindFirstChild("Humanoid") if tag and humanoid and humanoid.Health > 0 then table.insert(activecontestants, player) end end end end end if #activecontestants <= 1 then break end wait() end
This is my entire script. In here, it manages rounds in a game and loads maps. It worked just fine in my baseplate testing environment; however, it doesn't seem to be running at all when I impliment it into my game for testing. It does not show any errors, either.
If you have an answer, please explain your answer so that I understand the problem in the future. Thank you!