1 | local function onTeamChange() |
2 | a.TextLabel.TextColor 3 = Player.Team.TeamColor.Color |
3 | b.TextLabel.TextColor 3 = Player.Team.TeamColor.Color |
4 | end |
5 |
6 | Player:GetPropertyChangedSignal( "Team" ):Connect(onTeamChange()) |
Attempting to detect a team change and change a text label based on the teamchange but its throwing the error
Passed value is not a function
Any help is appreciated, cheers
This is because you are trying to fire the function and connect it at the same time.
1 | local function onTeamChange() |
2 | a.TextLabel.TextColor 3 = Player.Team.TeamColor.Color |
3 | b.TextLabel.TextColor 3 = Player.Team.TeamColor.Color |
4 | end |
5 |
6 | Player:GetPropertyChangedSignal( "Team" ):Connect(onTeamChange) |
Easy fix is to just remove the () from here
1 | Player:GetPropertyChangedSignal( "Team" ):Connect(onTeamChange()) |
As they not needed.
Hope this solves your question :D