You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want the script to break out of first ‘if’ statement if someone leaves the team and move to second ‘if’ statement
- What is the issue? Include screenshots / videos if possible!
It does move to second ‘if’ statement in the beginning but after i join other team, it still counts me in the team i just left
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
tried to find the solution but cant find any similar topics somehow
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
so i am working on a small round based game and i found this problem where if a person gets added to the ‘playing’, script counts that person but if that person leaves the ‘playing’ team and joins ‘lobby’ team, script doesn’t lower the amount of players in ‘playing’ team. if i cant fix this then game wont end if there is only one person alive in ‘playing’ team. First time posting here so i hope formatting and my explaination isn’t hard to understand
while true do
local TEAMS = game:GetService("Teams").Playing:GetPlayers()
local numberofplayers = #TEAMS
wait(1)
if numberofplayers >= 1 then
print(numberofplayers .. " There is one person in playing team")
end
if numberofplayers == 0 then
print(numberofplayers .. " There is no one in playing team")
end
end