I want to make that after counting all the players threw for one team. I made the count in another script and the problem is not this. The problem in this -----------------------------------------ServerScriptService.Script:4: attempt to index local 'player' (a nil value)
The script itself
local player = game.Players.LocalPlayer
if game.Workspace.NYGNO.BrickColor == BrickColor.new("Lily white") then player.TeamColor = BrickColor.new("Forest green") end
Where is the script
ServerScriptService \ Script
A normal Script doesn't use LocalPlayer (only LocalScript does). You have to use another method to get the player. Here are some ideas what you can get player from:
I. 'Touched' event. This event fires, when player touches given part, for example:
script.Parent.Touched:connect(function(hit) -- Hit is a part of character which actually touched the part (left leg, head, right arm etc.) local player = hit.Parent -- Here's the player :) -- Do anything you want. end)
II. Player joining the game. Event 'PlayerAdded' fires whemever any player joins the game:
game:GetService("Players").PlayerAdded:connect(function(player) -- Player is actually here, you don't need to write a variable :) -- Do anything you want here end)
I hope I helped :D