Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I convert Brickcolor to Color3?

--// 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

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!

7 comments

1

Wow, I am actually really thankful for your help.

0

No problem!

0

Wait, but for some reason, the TextColor3 only changes to 0,0,0 never the teamcolor.

0

Are you getting an errors?

0

Doesn't seem to have any.

0

Are you sure the TeamColor isn't just black?

0

I made three different teams: Red, orange and yellow. They aren't black.

This discussion is preserved as it was. New answers, comments, and votes are closed.