PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

TextStrokeTransparency

TextLabel

float

.The TextStrokeTransparency property sets the transparency of the stroke, or outline, of rendered text. This property and TextLabel/TextStrokeColor3 determine the visual properties of the text stroke.

Text stroke is rendered before normal text and is simply 4 renderings of the same text in +/- 1 pixel offsets in each direction. Text stroke rendering works independently and identically to TextLabel/TextColor3 and TextLabel/TextTransparency. Since text stroke is simply multiple renderings of the same transparency, this property is essentially multiplicative on itself four times over (e.g. a TextStrokeTransparency of 0.5 appears about the same as TextTransparency of 0.0625, or 0.5^4). Therefore, it’s recommended to set TextStrokeTransparency to a value in the range of 0.75 to 1 for more a more subtle effect.


Code Samples


Text Highlight Oscillation

This code sample oscillates a TextLabel’s TextStrokeTransparency so that it blinks the highlight of a text.

local textLabel = script.Parent

-- How fast the highlight ought to blink
local freq = 2

-- Set to yellow highlight color
textLabel.TextStrokeColor3 = Color3.new(1, 1, 0)

while true do
	-- math.sin oscillates from -1 to 1, so we change the range to 0 to 1:
	local transparency = math.sin(workspace.DistributedGameTime*math.pi*freq)*.5+.5
	textLabel.TextStrokeTransparency = transparency
	wait()
end