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

What is wrong with this Billboard Gui script? [ANSWERED]

I wrote the Billboard Gui script to display the rank of a player in a group I'm in. I tested it through the Run Server part of Studio, so obviously I would be a Guest, and it worked perfectly fine, except for the fact that the TextColor3 and the TextStrokeColor3 were set to incredible numbers. TextColor3 number was set to: 6885, 10710, 13515 TextStrokeColor3 number was set to: 44115, 44115, 44115

Why is that happening? Here is the code:

local GroupID = 490811

game.Players.PlayerAdded:connect(function(player)

repeat wait() until player.Character.Head
 
local bg = Instance.new("BillboardGui")
bg.Parent = player.PlayerGui
bg.Adornee = player.Character.Head
-- Same size as Head
bg.Size = UDim2.new(2, 0, .78, 0)
-- Above (defaults to inside)
bg.StudsOffset = Vector3.new(0, 2, 0)
bg.Active = true
 
 
local text = Instance.new("TextLabel")
text.Parent = bg
text.BackgroundTransparency = 1
text.TextStrokeTransparency = 0
text.Position = UDim2.new(0, 0, 0.25, 0)
text.Size = UDim2.new(1, 0, 1, 0)
text.Font = Enum.Font.Legacy
text.FontSize = Enum.FontSize.Size18
text.TextScaled = true
	if player:IsInGroup(GroupID) then --if in group
			if player:GetRankInGroup(GroupID) >= 10 then
				text.Text = "[ADMIN] - ["..player:GetRoleInGroup(GroupID).."]"
				text.TextStrokeColor3 = Color3.new(118, 13, 136)
				text.TextColor3 = Color3.new(190, 190, 190)
			elseif player:GetRankInGroup(GroupID) < 10 then
				text.Text = "[MB] - ["..player:GetRoleInGroup(GroupID).."]"
				text.TextStrokeColor3 = Color3.new(62, 62, 62)
				text.TextColor3 = Color3.new(173, 173, 173)
			end
	else
		text.Text = "Guest"
		text.TextStrokeColor3 = Color3.new(173, 173, 173)
		text.TextColor3 = Color3.new(27, 42, 53)
	end
end)

1 answer

✓ Accepted answer

Whenever you use a number higher than 1 for TextColor3, it automatically becomes an rgb color so you have to put # here/255

local GroupID = 490811

game.Players.PlayerAdded:connect(function(player)

repeat wait() until player.Character.Head

local bg = Instance.new("BillboardGui")
bg.Parent = player.PlayerGui
bg.Adornee = player.Character.Head
-- Same size as Head
bg.Size = UDim2.new(2, 0, .78, 0)
-- Above (defaults to inside)
bg.StudsOffset = Vector3.new(0, 2, 0)
bg.Active = true


local text = Instance.new("TextLabel")
text.Parent = bg
text.BackgroundTransparency = 1
text.TextStrokeTransparency = 0
text.Position = UDim2.new(0, 0, 0.25, 0)
text.Size = UDim2.new(1, 0, 1, 0)
text.Font = Enum.Font.Legacy
text.FontSize = Enum.FontSize.Size18
text.TextScaled = true
    if player:IsInGroup(GroupID) then --if in group
            if player:GetRankInGroup(GroupID) >= 10 then
                text.Text = "[ADMIN] - ["..player:GetRoleInGroup(GroupID).."]"
                text.TextStrokeColor3 = Color3.new(118/255, 13/255, 136/255)
                text.TextColor3 = Color3.new(190/255, 190/255, 190/255)
            elseif player:GetRankInGroup(GroupID) < 10 then
                text.Text = "[MB] - ["..player:GetRoleInGroup(GroupID).."]"
                text.TextStrokeColor3 = Color3.new(62/255, 62/255, 62/255)
                text.TextColor3 = Color3.new(173/255, 173/255, 173/255)
            end
    else
        text.Text = "Guest"
        text.TextStrokeColor3 = Color3.new(173/255, 173/255, 173/255)
        text.TextColor3 = Color3.new(27/255, 42/255, 53/255)
    end
end)

1 comment

0

I tested it by joining your group and it works fine after i added the /255

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