Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I convert Brickcolor to Color3?

Asked by
Ieowyyn 69
4 years ago
--// variables //--
local gui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        if char.Head:FindFirstChild("BillboardGui") then
            print("BillboardGui is already inserted")
        else
            local clone = gui:Clone()
            clone.frame.name.Text = player.Name
            clone.frame.name.TextColor3 = BrickColor.new(player.TeamColor).Color
            clone.Parent = game.Workspace:WaitForChild(player.Name).Head
        end
    end)
end)

ServerScriptService.Script:11: bad argument #1 (Color3 expected, got BrickColor) I did what most answers said to do, but it isn't working.

1 answer

Log in to vote
1
Answered by
DesertusX 435 Moderation Voter
4 years ago

I don't think that there is a way to do this, but you don't need to change it to BrickColor. Just use Color3.fromRGB like in your previous post. Also, remove .Color on line 11. player.TeamColor is already an RGB colour.

This is what your script should look like:

--// variables //--
local gui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        if char.Head:FindFirstChild("BillboardGui") then
            print("BillboardGui is already inserted")
        else
            local clone = gui:Clone()
            clone.frame.name.Text = player.Name
            clone.frame.name.TextColor3 = Color3.fromRGB(player.TeamColor)
            clone.Parent = game.Workspace:WaitForChild(player.Name).Head
        end
    end)
end)

Hope this helps!

1
Wow, I am actually really thankful for your help. Ieowyyn 69 — 4y
0
No problem! DesertusX 435 — 4y
0
Wait, but for some reason, the TextColor3 only changes to 0,0,0 never the teamcolor. Ieowyyn 69 — 4y
0
Are you getting an errors? DesertusX 435 — 4y
View all comments (3 more)
0
Doesn't seem to have any. Ieowyyn 69 — 4y
0
Are you sure the TeamColor isn't just black? DesertusX 435 — 4y
0
I made three different teams: Red, orange and yellow. They aren't black. Ieowyyn 69 — 4y
Ad

Answer this question