I'm trying to make a script to check when a new player joins so it can prompt them with instructions. I have a script which changes there head to the color bright blue, and all the colors for a noob.
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local head = game.Workspace:WaitForChild(player.Name).Head wait(0.5) if head.BrickColor == "Bright blue" then print(player.Name.." is a noob!") else print("Not a noob") end end) end)
My script prints "Not a noob" but my head color is Bright blue. Anyway to fix this?
This will always result in false
. What you can do is compare the name of the BrickColor
to "Bright blue"
.
game:GetService("Players").PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) print(player, character.Head.BrickColor.Name == "Bright blue" and "Is a noob" or "Not a noob") end) end)
Terrain
. :GetService()
. This is the canonical way to get services. :GetService()
gets a service by class name, as opposed to by name.character.Head.BrickColor.Name == "Bright blue" and "Is a noob" or "Not a noob"
evaluates to "Is a noob"
, otherwise will evalĂșate to "Not a noob"
because they are not bright blue