How to Detect Player.Team.Changed for a loop

Hello, I’m trying to improve the Mobile Support for my game and I need to detect Player Team Changed for a loop to set mobile buttons visible.

1 Like

use :GetPropertyChangedSignal().

    --do whatever is needed.

if you are specifically changing the teamcolor instead of team, change “Team” to “TeamColor”


both your if statements do the same thing

Yes I know I just gave a sample of this code :slight_smile:

Thanks for the help but this didn’t work for me, I don’t know the reason :confused:

None of those work? Is it a LocalScript?

Make sure not to add it after a while loop. Anything after a while loop that isn’t in some sorry of function like corouting or task.spawn will make the code after not run.

I tried every way with that script but it doesn’t work, maybe the reason is I making a game with character selection so I used another script it changed Character model and name, When enter the game, it only detects my main character’s team, does not do this when I select other characters, and only checks my main character team once. I tried GetPlayerFromCharacter and it doesn’t change anything I really need help

1 Like

Yeah it was a LocalScript Location is: game.StarterGui.ScreenGui.LocalScript

Try a ServerScript.

I get an error like this when I try it on serverScript

do not use server script for gui please

also dont use teamcolor just use team when check if, etc.

Im pretty sure its

    -- stuff

I forgot that this topic is still open, I solved the problem a few months ago, but I can mark it as a solution, maybe those who need can find the answer quickly, thanks.

no problem! I’m glad I was able to help!

1 Like