Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Passed value is not a function?

local function onTeamChange()
a.TextLabel.TextColor3 = Player.Team.TeamColor.Color
b.TextLabel.TextColor3 = Player.Team.TeamColor.Color
end

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

1 answer

✓ Accepted answer

This is because you are trying to fire the function and connect it at the same time.

local function onTeamChange()
a.TextLabel.TextColor3 = Player.Team.TeamColor.Color
b.TextLabel.TextColor3 = Player.Team.TeamColor.Color
end

Player:GetPropertyChangedSignal("Team"):Connect(onTeamChange)

Easy fix is to just remove the () from here

Player:GetPropertyChangedSignal("Team"):Connect(onTeamChange())

As they not needed.

Hope this solves your question :D

This discussion is preserved as it was. New answers, comments, and votes are closed.