I am trying to make a part that if it detects my userid, it will change the BrickColor to gold, and I have tried this:
if game.Players.LocalPlayer.userid == ("1108976841") then script.parent.BrickColor = BrickColor.new("Gold") end
This does not seem to work. Does anyone have a solution?
if you are using a local script, this is what you should do:
if game.Players.LocalPlayer.UserId == 1108976841 then -- no brackets and no quotation marks, also, It has to be UserId, not userid (sad). script.Parent.BrickColor = BrickColor.new("Gold") end
if you are using a server script, then you should do this:
game.Players.PlayerAdded:Connect(function(player) -- you use the player parameter if player.UserId == 1108976841 then -- the rest is basically the same script.Parent.BrickColor = BrickColor.new("Gold") end end)
userid (which is actually supposed to be UserId) requires a number value - not a string:
game.Players.LocalPlayer.UserId == 1108976841
Also, LocalPlayer won't work in a server script (if that's what you're using; if not, be aware that a LocalScript will not display the color for anyone else).
Please excuse me for my dumb mistakes, but I followed all of this advice and none of it worked.