Lostude
(Lostude)
October 20, 2022, 3:38pm
1
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()
DataSigh
(DataSigh)
October 20, 2022, 3:42pm
2
What’s happening instead?
CZXPEK
(czo)
October 20, 2022, 3:42pm
3
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
Lostude
(Lostude)
October 20, 2022, 3:43pm
4
It doesn’t change transparency at all.
Lostude
(Lostude)
October 20, 2022, 3:44pm
5
This didn’t work, it’s the same result as before.
DataSigh
(DataSigh)
October 20, 2022, 3:49pm
6
You sure you’re referencing the correct UI?
Lostude
(Lostude)
October 20, 2022, 3:50pm
7
Yep, I’m certain.
local GUI = script.Parent
2112Jay
(2112Jay)
October 20, 2022, 3:55pm
8
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.
Lostude
(Lostude)
October 20, 2022, 3:58pm
9
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
2112Jay
(2112Jay)
October 20, 2022, 3:59pm
10
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.
Entildo
(Fase)
October 20, 2022, 4:04pm
11
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()
DataSigh
(DataSigh)
October 20, 2022, 4:04pm
12
Try putting a print statement inside the repeat to see if the code is executing
Lostude
(Lostude)
October 20, 2022, 4:10pm
13
The code executes but does nothing…
Lostude
(Lostude)
October 20, 2022, 4:25pm
14
This didn’t work either, I’m really confused.
2112Jay
(2112Jay)
October 20, 2022, 4:28pm
15
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?
Entildo
(Fase)
October 20, 2022, 4:28pm
16
Could you send a rbx file so I can test it out?
Lostude
(Lostude)
October 20, 2022, 4:29pm
17
It’s visible, it just doesnt work. I don’t know why.
Lostude
(Lostude)
October 20, 2022, 4:29pm
18
Give me a few moments while I do.
Entildo
(Fase)
October 20, 2022, 4:45pm
20
Thank you, I will see and send you the working code
1 Like