I've been scripting for a bit so my brain doesn't really understand the words anymore, if you know the feeling.
local Flag = script.Parent.Parent.Flag enabled = true function onClick(Character) local Player = game.Players:GetPlayerFromCharacter(Character) script.Parent.TeamColor.Value = Player.TeamColor end script.Parent.ClickDetector.MouseClick:connect(onClick)
Returns a "attempt to index local Player (a nil value)"
I'm pre-occupied so, even while looking at other base scripts from FM, I can't physically read them to tell what's wrong right now. Thanks in advanced.
Your problem is that the MouseClick function returns the Player who clicked not the Character who clicked. This makes it so that on line 8 you are searching for the player with the player rather than the player's character.
local flag = script.Parent.Parent.Flag local enabled = true script.Parent.ClickDetector.MouseClick:connect(function(player) script.Parent.TeamColor.Value = player.TeamColor end)