Hi. My script is meant to keep seeing how many players are in the alive team while the boolValue “inRound” is true. When there is 1, it should print ‘we have a winner,’ but it doesn’t seem to be working. There are no errors in the output.
local Teams = game:GetService("Teams")
while inround.Value == true do
wait(0.1)
local teamPlayers = Teams["Alive"]:GetPlayers()
local aliveCount = #teamPlayers
if aliveCount == 1 then
print("we have a winner")
end
end
The inRound value can be set to false and stop the loop from running entirely, use a while true do loop and check if the value is true (will cause any code below it to not run as it yields, put it at the end of the script if this matters):
while true do
wait(0.1)
if inRound.Value == true then -- check
local teamPlayers = Teams["Alive"]:GetPlayers()
local aliveCount = #teamPlayers
if aliveCount == 1 then
print("we have a winner")
end
end
end
I assume you have but have you checked if inround.Value is actually True, and if, was it set to True by the same sided script (local-local, global-global). Also check if the script is not disabled.