I am trying to change a character’s visor (There’s a startercharacter that has one) when a player joins the game. It can pick between four different colors and each one has a corresponding visor texture. When I test it, I don’t get any errors but the visor does not change
game.Players.PlayerAdded:Connect(function(player)
local character = player.CharacterAdded:Connect(function(character)
local colors = {
BrickColor.new("Bright red"),BrickColor.new("Sea green"),BrickColor.new("Electric blue"),BrickColor.new("Bright yellow")
}
character.Torso.BrickColor = colors[math.random(1,#colors)]
if character.Torso.BrickColor == ("Electric blue") then
character.Visor.Handle.Mesh.TextureId.Value = "http://www.roblox.com/asset/?id=42944896"
else
if character.Torso.BrickColor == ("Bright red") then
character.Visor.Handle.Mesh.TextureId.Value = "http://www.roblox.com/asset/?id=1163671"
else
if character.Torso.BrickColor == ("Bright yellow") then
character.Visor.Handle.Mesh.TextureId.Value = "http://www.roblox.com/asset/?id=42580749"
else
if character.Torso.BrickColor == ("Sea green") then
character.Visor.Handle.Mesh.TextureId.Value = "http://www.roblox.com/asset/?id=20264549"
end
end
end
end
end)
end)
game.Players.PlayerAdded:Connect(function(player)
local character = player.CharacterAdded:Connect(function(character)
local colors = {
BrickColor.new("Bright red"),BrickColor.new("Sea green"),BrickColor.new("Electric blue"),BrickColor.new("Bright yellow")
}
character.Torso.BrickColor = colors[math.random(1,#colors)]
if character.Torso.BrickColor == ("Electric blue") then
character.Visor.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=42944896"
else
if character.Torso.BrickColor == ("Bright red") then
character.Visor.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=1163671"
else
if character.Torso.BrickColor == ("Bright yellow") then
character.Visor.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=42580749"
else
if character.Torso.BrickColor == ("Sea green") then
character.Visor.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=20264549"
end
end
end
end
end)
end)