Yes its like this now:
until roundLenght == 0 or canWin == false or #workspace.Ingame:GetChildren() == 0
if canWin == false then
status.Value = "Winners: "..table.concat(winners,",")
Yes its like this now:
until roundLenght == 0 or canWin == false or #workspace.Ingame:GetChildren() == 0
if canWin == false then
status.Value = "Winners: "..table.concat(winners,",")
can you show me your full script?
Here you go:
local status = game.ReplicatedStorage.Status
local maps = game.ReplicatedStorage.Maps:GetChildren()
while true do
status.Value = "Waiting For Players"
repeat task.wait() status.Value = "Waiting for a player to join" until #game.Players:GetPlayers() >= 1
if #game.Players:GetPlayers() >= 1 then
status.Value = "Starting"
for i = 1,15 do
status.Value = "Next round will start in: "..15-i
wait(1)
end
local rand = math.random(1, #maps)
local map = maps[rand]:Clone()
map.Parent = workspace
status.Value = "The next minigame is: "..map.Name
wait(5)
local players = game.Players:GetChildren()
for i = 1,#players do
if players[i].Character ~= nil then
local spawnLocation = math.random(1,#map.Teleports:GetChildren())
players[i].Character:MoveTo(map.Teleports:GetChildren()[spawnLocation].Position)
players[i].Character.Parent = workspace.Ingame
end
end
local winners = {}
local roundLenght = 60
local canWin = true
local roundType = ""
if map:FindFirstChild("Race") then
roundType = "Race"
map.WinnerPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and canWin == true then
if #winners <= 3 then -- checks amount of values in the table
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if not table.find(winners,plr.Name) then
table.insert(winners,plr.Name)
status.Value = hit.Parent.Name.." Has won!"
plr.leaderstats.Wins.Value = plr.leaderstats.Wins.Value +1
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value +100
plr:LoadCharacter()
end
else
canWin = false
table.clear(winners)
end
end
end)
end
repeat
roundLenght = roundLenght -1
status.Value = "Time left: "..roundLenght.."\n Current Winners: "..table.concat(winners,",")
wait(1)
until roundLenght == 0 or canWin == false or #workspace.Ingame:GetChildren() == 0
if canWin == false then
status.Value = "Winners: "..table.concat(winners,",")
end
wait(3)
map:Destroy()
local players = game.Players:GetChildren()
for i = 1,#players do
if players[i].Character ~= nil then
players[i]:LoadCharacter()
end
end
end
end
oh ye i forgot that i cleared up the table so the table would be empty
So its not really possible to show the Winners: at the end of the round?. Just say so u already helped me alot!. this is just a small thing.
no it is possible dw i’ll fix it rq
local status = game.ReplicatedStorage.Status
local maps = game.ReplicatedStorage.Maps:GetChildren()
while true do
status.Value = "Waiting For Players"
repeat task.wait() status.Value = "Waiting for a player to join" until #game.Players:GetPlayers() >= 1
if #game.Players:GetPlayers() >= 1 then
status.Value = "Starting"
for i = 1,15 do
status.Value = "Next round will start in: "..15-i
wait(1)
end
local rand = math.random(1, #maps)
local map = maps[rand]:Clone()
map.Parent = workspace
status.Value = "The next minigame is: "..map.Name
wait(5)
local players = game.Players:GetChildren()
for i = 1,#players do
if players[i].Character ~= nil then
local spawnLocation = math.random(1,#map.Teleports:GetChildren())
players[i].Character:MoveTo(map.Teleports:GetChildren()[spawnLocation].Position)
players[i].Character.Parent = workspace.Ingame
end
end
local winners = {}
local roundLenght = 60
local canWin = true
local roundType = ""
if map:FindFirstChild("Race") then
roundType = "Race"
map.WinnerPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and canWin == true then
if #winners <= 3 then -- checks amount of values in the table
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if not table.find(winners,plr.Name) then
table.insert(winners,plr.Name)
status.Value = hit.Parent.Name.." Has won!"
plr.leaderstats.Wins.Value = plr.leaderstats.Wins.Value +1
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value +100
plr:LoadCharacter()
end
else
canWin = false
end
end
end)
end
repeat
roundLenght = roundLenght -1
status.Value = "Time left: "..roundLenght.."\n Current Winners: "..table.concat(winners,",")
wait(1)
until roundLenght == 0 or canWin == false or #workspace.Ingame:GetChildren() == 0
if canWin == false then
status.Value = "Winners: "..table.concat(winners,",")
table.clear(winners)
end
wait(3)
map:Destroy()
local players = game.Players:GetChildren()
for i = 1,#players do
if players[i].Character ~= nil then
players[i]:LoadCharacter()
end
end
end
end
Im sorry to say, but its still the same as its been and it returns no errors
this would check if there is any winners or
the countdown timer has ended
if canWin == false or roundLenght == 0 then
status.Value = "Winners : "..table.concat(winners,",")
table.clear(winners)
end
It still returns the same…
If we cant fix it isnt that big of an issue for now u helped me alot already
the status Value should change since the repeat loop has ended.
make sure resetonspawn is off
also add a print in here
It is already off so that’s not the problem.
just remove the if statement and try then
status.Value = "Winners : "..table.concat(winners,",")
table.clear(winners)
It works now thanks alot! could u explain to me why it wouldnt work with the if statement? because i can learn from that