Text not italicizing when changed via script

I created a super simple GUI to show the player how much money they have. I’d like it to italicize for about 0.1 seconds whenever they gain/loose money.

I have the script set up, and everything works except the italicizing. I’ve tried changing the FontFace.Style via both a local and server script, but it won’t actually update.

I found a workaround to this, by using rich text for italics instead of the FaceFace.Style property, but for various reasons it seems like it will be very prone to error due to my specific use case.

The part of the script that actually attempts to change the font style does not return any errors. It does show in the console if a print statement is added, so the issue doesn’t seem to be that it is not running. Here is the problematic part of the script:

	script.Parent.Parent.FontFace.Style = Enum.FontStyle.Italic
	task.wait(0.1)
	script.Parent.Parent.FontFace.Style = Enum.FontStyle.Normal

If I attempt to print the font style, it returns as normal even after being set to italic. Is this an engine bug? Are there any other workarounds?

(note that this issue occurs no matter if rich text is on or off)

The FontFace property of a TextLabel is read-only meaning it can’t be modified directly, to change the text into italic you should create a new FontFace. If you want to add just italic you can just copy the family and weght and only change italic like this:

local textLabel = playerGui:WaitForChild("ScreenGui").TextLabel

textLabel.FontFace = Font.new(
	textLabel.FontFace.Family,
	textLabel.FontFace.Weight,
	Enum.FontStyle.Italic
)

task.wait(0.1)

textLabel.FontFace = Font.new(
	textLabel.FontFace.Family,
	textLabel.FontFace.Weight,
	Enum.FontStyle.Normal
)
2 Likes