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

How to make group name handler border change colors?

Asked by 7 years ago
Edited 7 years ago

I have a nametag handler for a group but I want to make the border change colors how do I do that?

function Create(ClassName)
    return function(Properties)
        local Obj = Instance.new(ClassName)

        for i,v in pairs(Properties) do
            if type(i) == 'number' then
                v.Parent = Obj
            else
                Obj[i] = v
            end
        end

        return Obj
    end
end

function HandleCharacter(Player, Character)
    local FakeHead = Character:WaitForChild('Head'):clone()

    FakeHead.Name = 'FakeKestrelHead'
    FakeHead.Parent = Character
    FakeHead.face:Destroy()
    Character.Head.Transparency = 1

    Create'Weld'{
        Name = 'FakeHeadWeld';
        Parent = FakeHead;
        Part0 = Character.Head;
        Part1 = FakeHead;
    }
    Create'BillboardGui'{
        Name = 'Nametag';
        Parent = FakeHead;
        Size = UDim2.new(5, 0, 0.5, 0);
        StudsOffset = Vector3.new(0, 2, 0);
        -----
        Create'TextLabel'{
            Name = 'NameLabel';
            BackgroundTransparency = 1;
            Size = UDim2.new(1, 0, 1, 0);
            Font = 'SourceSans';
            Text = Character.Name .. ', ' .. Player:GetRoleInGroup(3034207);
            TextColor3 = Color3.new(1, 1, 1);
            TextScaled = true;
            TextStrokeTransparency = 0.5;
        };
    }

    FakeHead.BrickColor = Character.Head.BrickColor

    Character.Head.Changed:connect(function()
        Character.Head.Transparency = 1
        FakeHead.BrickColor = Character.Head.BrickColor
    end)
    Character.Head.Mesh.Changed:connect(function()
        FakeHead:WaitForChild('Mesh').MeshId = Character.Head:WaitForChild('Mesh').MeshId
    end)
end

function HandlePlayer(Player)
    if Player.Character then
        HandleCharacter(Player, Player.Character)
    end
    Player.CharacterAdded:connect(function(Character) HandleCharacter(Player, Character) end)
end

game.Players.PlayerAdded:connect(HandlePlayer)
for i,v in pairs(game.Players:GetPlayers()) do HandlePlayer(v) end

1 answer

Log in to vote
0
Answered by 7 years ago

First, you would have to make sure the border is visible

button.BorderSizePixel = 1 --Can really change this to anything other than 0

Then apply the color.

button.BorderColor3 = Color3.new(1, 1, 1) --Anything here as well
0
@Turtletowerz I want it changing between colors do I do BrickColor.new(math.random() after the = thecoolx123 -5 — 7y
0
You would do Color3.new(math.random(1, 255), math.random(1, 255), math.random(1, 255)) I think User#9949 0 — 7y
Ad

Answer this question