I’m sorry for making this post, I know this is not a place to ask for something like this, but at the moment I have no one else to help me, and this round system is practically the last thing I need to publish my game.
Well… This will be complicated to explain, basically i need a round system, however, the game has a character selection system whenever the player spawns, so it would be necessary for the round system to check if at least 2 players are ready to enter the match. The last player alive would win a reward, and at the end of each game the map would receive a Destroy() since before starting the game, a map would be randomly chosen.
I don’t even know what’s not working, it’s just giving me a headache. Much of what I said above I was not able to make it work.
I tried a lot of alternatives, I’ve been researching for 2 or 3 days, I’m starting to get desperate looking at this script, and now it got to the point where I looked at it and didn’t understand what I’m doing anymore, I was going to redo it all again, but really I don’t know where to start this time, but I was using folders to store BoolValues with the names of the players who were in the match or in the lobby:
I don’t think this script is going to be useful, but here’s the mess I’ve made so far:
local roundLength = 5
local gameStartingLength = 5
local intermissionLength = 10
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local Folder = game.ReplicatedStorage.InGame
local inGame = Folder:GetChildren()
local Folder2 = game.ReplicatedStorage.InSpawn
local inSpawn = Folder2:GetChildren()
Folder.ChildRemoved:Connect(function()
if #inGame == 1 then
local winner = Folder:IsA("BoolValue")
local dataWinner = game.Players:FindFirstChild(winner.Name):WaitForChild("Data")
dataWinner.Coins.Value = dataWinner.Coins.Value + 800
dataWinner.PowerLevel.Value = dataWinner.PowerLevel.Value + 1600
winner:Detroy()
elseif #inGame == 0 then
InRound.Value = false
end
end)
InRound.Changed:Connect(function()
if InRound.Value == true then
for _,v in pairs(game.ReplicatedStorage.InSpawn:GetChildren()) do
wait()
local char = workspace:FindFirstChild(v.Name)
local ArenaSpawn = workspace.Maps.Map.Spawn
v.Parent = game.ReplicatedStorage.InGame
char.HumanoidRootPart.CFrame = ArenaSpawn.CFrame * CFrame.new(math.random(-50, 50), 0, math.random(-50, 50))
end
end
end)
local function intermissionTimer()
for i = intermissionLength, 0, -1 do
wait(1)
if InRound.Value == false then
if #inSpawn >= 1 then
Status.Value = "Intermission: "..i.." seconds left!"
end
else
return
end
end
local players = game.ReplicatedStorage.InSpawn:GetChildren()
if #players >= 1 then
Status.Value = "Preparing The Arena"
local x = game.ReplicatedStorage.Assets.Maps.Map:Clone()
x.Parent = workspace.Maps
wait(1)
for i = gameStartingLength, 0, -1 do
wait(1)
if InRound.Value == false then
if #inSpawn >= 1 then
Status.Value = "Game Starts in "..i.." seconds"
else
Status.Value = "2 Players or more are required for the start..."
end
else
return
end
end
InRound.Value = true
else
Status.Value = "2 Players or more are required for the start..."
wait(3)
end
end
local function roundTimer()
for i = roundLength, 0, -1 do
wait(1)
if InRound.Value == true then
if #inGame == 1 then
local winner = Folder:IsA("BoolValue")
local dataWinner = game.Players:FindFirstChild(winner.Name):WaitForChild("Data")
dataWinner.Coins.Value = dataWinner.Coins.Value + 800
dataWinner.PowerLevel.Value = dataWinner.PowerLevel.Value + 1600
winner:Detroy()
elseif #inGame == 0 then
InRound.Value = false
else
Status.Value = "Game: "..i.." seconds left!"
end
else
return
end
end
end
while wait() do
if InRound.Value == false then
intermissionTimer()
else
roundTimer()
end
end
Sorry again, and thank you very much for your attention!