We use cookies on this site to enhance your user experience

Oscillate ImageTransparency

Oscillate ImageTransparency

Oct 01 2018, 2:24 AM PST

This code sample oscillates the ImageTransparency of an ImageLabel/ImageButton from 0 to 1 using a sine wave.

local imageLabel = script.Parent

local RunService = game:GetService("RunService")

local function onRenderStep()
	-- Oscillate ImageTransparency from 0 to 1 using a sine wave
	imageLabel.ImageTransparency = math.sin(workspace.DistributedGameTime*math.pi)*.5+.5