I am confused, I'm consistently getting an error but the script works correctly.
Just an example of the type of code I'm talking about. Not the entire code just the pertinent lines.
local rt = game.Workspace.redteam
function teamchange(p1,color)
game.Players:FindFirstChild(p1).TeamColor = BrickColor.new(color) --Line 31
end
rt.Touched:connect(function(hit)
print(hit.Parent)
teamchange(hit.Parent.Name,"Really red")
end)
The console always says this:
ServerScriptService.Main Script:31: attempt to index a nil value

1 comment
OHHHHHHHH Cool thanks.