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)
Put one Parent
property less. Players
is a folder that all Player
instances stay in. But Players
isnt a Player
instance. Got it?