script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Really red")
end)
I get the TeamColor is not a valid member of Players error. Please help!
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Really red")
end)
I get the TeamColor is not a valid member of Players error. Please help!
I assume since you are using a textButton or ImageButton you are using a local script. With local scripts you can actually get the "local player" by doing this
local player = game:GetService("Players").LocalPlayer
so if you change what you have and use localplayer, you can do this...
local player = game:GetService("Players").LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
player.TeamColor = BrickColor.new("Really red")
end)
Remember, LocalPlayer will ONLY work with a localscript; NOT a script. :) Good luck!
Put one Parent property less. Players is a folder that all Player instances stay in. But Players isnt a Player instance. Got it?
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Are you sure you're not parenting to far? As your error is stating that you went back to the service of Players, not the actual player itself. Try removing a "Parent" from line 2. And use Player.TeamColor = TeamName.TeamColor.