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

Changing color of text in function?

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

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

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?

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