Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[URGENT] Round system NOT working, unknown reason?

i need your help guys, my code doesnt work, for some reason that i dont figure it out, basically when i want to do stuff when the player is in round the code doesnt execute for no reason i dont know what's wrong with my code. PLS HELP

local inRound = game.ReplicatedStorage.InRound
local rs = game:GetService("ReplicatedStorage")
local serverStorage = game:GetService("ServerStorage")
local intermission = 15
local RoundLength = 120
local Status = game.ReplicatedStorage.Status
local Maps = game.ServerStorage.Maps:GetChildren()
local players = game.Players:GetPlayers()
local Timer = game.StarterGui.ScreenGui.TextLabel

Status.Changed:Connect(function()
	game.ReplicatedStorage.TimerEvent:FireAllClients()
end)

local function ChoosenMap()
	
	local randomizer = Maps[math.random(1,#Maps)]:Clone()
	randomizer.Parent = game.Workspace
	
end

local  givePlayers = coroutine.wrap(function()
	local players = game.Players:GetChildren()
	local tommyGun = serverStorage:FindFirstChild("Tommy Gun")
	if tommyGun then
		local tool = tommyGun:Clone()
	tool.Parent = players.Backpack
	end
end)


while true do
	repeat 
		
		Status.Value = "Need 2 players to start! "
		wait(1)
		
	until #game.Players:GetPlayers() >= 0
	
	
	
	for i = intermission,0,-1 do 
		Status.Value = "intermission: " .. i 
		wait(1)	
		print("loop 1 sucess")	
	end	
	
	inRound.Value = true
	wait(3)
	
	local players = game.Players:GetPlayers()
	if inRound == true then
		for i, v in pairs(game.Workspace.Lobby.LobbySpawns:GetChildren())do
			v.Enabled = false
		end
		
		ChoosenMap()
		wait(7)
		
		for i, plr in pairs(game.Players:GetChildren())do
			if plr.Character:FindFirstChild("Humanoid") then
				plr.Character.Humanoid.Health:TakeDamage(100)
			end
		end
		givePlayers()
	end
	
	
	print("getting on round code block.")
		
	
	for i = 120, 0, -1 do 
		Status.Value = "Round: " .. i
		wait(1)
	end
	
	if inRound == false then
		local lobbysP = game.Workspace.Lobby.LobbySpawns:GetChildren()
		lobbysP.Enabled = true
		ChoosenMap():Destroy()
		players.Backpack:ClearAllChildren()
		players.Character:FindFirstChild("Humanoid"):TakeDamage(100)
	end
end	
	
	
	
	

1 comment

0

how did you get the ghost fedora?

1 answer

local function round(n)
	return math.floor(n + 0.5)
end

maybe this might work?

This discussion is preserved as it was. New answers, comments, and votes are closed.