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

Changing color of text in function?

Asked by 5 years ago
Edited 5 years ago

So, I made a Text Box and when you press enter, the text you entered will then display above your head. The problem is, it works.... BUT when I try to add script to make it change color, font, and remove the border pixel, it doesn't work. I've looked into how to fix this but I still have no clue what to do. Thanks.

script.Parent.FocusLost:connect(function(enter)
    if enter then
        v = game.Players.LocalPlayer
        for a, mod in pairs(v.Character:children()) do
            if mod:findFirstChild("NameTag") then
                v.Character.Head.Transparency = 0 mod:Destroy()
            end
        end

        local char = v.Character
        local mod = Instance.new("Model", char)
        mod.BorderPixelSize = 0
        mod.Font = "Cartoon"
        mod.BackgroundColor3 = ("246, 197, 255")
        mod.Name = script.Parent.Text
        local cl = char.Head:Clone()
        cl.Parent = mod


        local hum = Instance.new("Humanoid", mod)
        hum.Name = "NameTag"
        hum.MaxHealth = 0
        hum.Health = 0

        local weld = Instance.new("Weld", cl) weld.Part0 = cl weld.Part1 = char.Head
        char.Head.Transparency = 1
    end
end)

2 answers

Log in to vote
0
Answered by
cegberry 432 Moderation Voter
5 years ago

Are you sure a model contains the following properties?:

BorderSizePixel Font BackgroundColor

You may want to recheck your code to make sure it references a TextLabel, not an Model

Ad
Log in to vote
-1
Answered by 5 years ago

local mod = Instance.new("Model", char) local mod is model, not text box

mod.BorderPixelSize = 0 mod.Font = "Cartoon"

you're trying to change font and border pixel size of model?

Answer this question