Im trying to make a function where it checks to see if All the playing values in all players are finished so it can stop a for loop. However, the function is ignored.
Function-
function Finess() for i, v in pairs(game.Players:GetChildren()) do if v.PlayerValues.Playing.Value == false then return end end end
for i = 120,1,-1 do Status.Value = i Finess() wait(1) end
I would 1st recommend that you make a table with the values in to make is easier to access.
Your function did not return any value so you will never know when all of the players have finished.
local valList = {} for I,v in pairs(game.Players:GetChildren()) do table.insert(valList, v.PlayerValues.Playing) -- add the reference to our table end -- check all players function Finess() for I,v in pairs(valList ) do -- loop using our list if not v.Value then -- when we find the 1st player who has not finished return false as we don't need to day anything else return false end end return true -- all players finished end for i = 120,1,-1 do Status.Value = I if Finess() then -- all players have finished -- break end wait(1) end
hope this helps.