Image Transparency not changing

Hey there, I am trying to change the image label’s image transparency for a loading screen. It doesn’t change however.

local function FadeInICON()
	repeat
		GUI.SmileIcon.ImageTransparency -= 0.05
		task.wait(0.02)
	until GUI.SmileIcon.ImageTransparency == 0
end
task.wait(2)
FadeInICON()

What’s happening instead?

i would recommend using TweenService its better and more compact

game:GetService("TweenService"):Create(GUI.SmileIcon, TweenInfo.new(0.2, Enum.EasingStyle.Linear), {ImageTransparency = 0}):Play()
2 Likes

It doesn’t change transparency at all.

This didn’t work, it’s the same result as before.

You sure you’re referencing the correct UI?

Yep, I’m certain.

local GUI = script.Parent

image

local function FadeInICON()
	while true do
		GUI.SmileIcon.ImageTransparency -= 0.05
		task.wait()
		if GUI.SmileIcon.ImageTransparency < 0.05 then  
			break
		end
	end	GUI.SmileIcon.ImageTransparency = 0
end)

task.wait(2)
FadeInICON()

]

Should work like that.

You didn’t add a . between Image.Transparency. It should end with .Transparency
Maybe you just added the word Image, idk… GUI.SmileIcon.Transparency = 0
Also, the way your loop was set up it would never exit.

This still didn’t work, I’m not sure what it can be.

EDIT: ImageTransparency is a property of an ImageLabel so that wasn’t the mistake

Check your syntax… That should work. Sorry that was a quick reply. I’ll correct my post.
Edit: I re-made that loop the way I would do it. If I was doing it tht way.

Try getting the GUI from the player instead,

local TweenService = game:GetService("TweenService")

local PlayerGUI = game.Players.LocalPlayer.PlayerGui
local GUI = PlayerGUI.IntroGUI.Background
local SmileIcon = GUI.SmileIcon

TweenService:Create(SmileIcon , TweenInfo.new(0.2, Enum.EasingStyle.Linear), {ImageTransparency = 0}):Play()

Try putting a print statement inside the repeat to see if the code is executing

The code executes but does nothing…

This didn’t work either, I’m really confused.

The script I posted and corrected should work fine. This is just a simple fade out. There is something else going on… Is it even visable at all?

Could you send a rbx file so I can test it out?

It’s visible, it just doesnt work. I don’t know why.

Give me a few moments while I do.

intro.rbxl (43.9 KB)

Thank you, I will see and send you the working code :+1:

1 Like