Gui Transparency not changing

I am attempting to make the GUI fade away when a button is pressed, however: The expected behaviour is not happening and instead the GUI destroys itself without fading away, however the text still prints.

The expected behaviour is to make the GUI fade away and then destroy itself.

The script:

local Players = game:GetService("Players").LocalPlayer
local TweenService = game:GetService("TweenService")

local TV = script.Parent

Players.CharacterAppearanceLoaded:Connect(function(player)
	local StartButton = script.Parent.Image.Continue
	StartButton.Text = "Start"
	
	script.Parent.Transparency = 0
	
	StartButton.MouseButton1Click:Connect(function()
		repeat
		script.Parent.Transparency += 0.1
		script.Parent.Image.Transparency += 0.1
		print("Transparency is Changing")
		wait(0.1)
		until script.Parent.Transparency >= 1
		script.Parent:Destroy()
	end)
end)
1 Like

What is the classname if this “image”? is it a decal? or texture? of maybe gui?

The classname of the image is a frame

We need information of the GUIObjects, screenshot the ScreenGui Childrens

Here you go.
image

Frames only have BackgroundTransparency property.

Then what is this?

What if .Transparency=math.min(1,.Transparency+0.1) works.

Nope, not even BackgroundTransparency or math min work.

However I can tween, but it’s probably slower.

So… What dev console saying? If console saying something…

It’s printing just fine
image

And, replace wait(0.1) to task.wait(0.1) to avoid deprecated.

print("Transparency is Changing, Current Transparency is: "..script.Parent.Transparency.."and "..script.Parent.Image.Transparency)

Very weird,

Looks like image’s transparent was 1 initially.

1 Like
Players.CharacterAppearanceLoaded:Connect(function(player)
	local StartButton = script.Parent.Image.Continue
	StartButton.Text = "Start"
	
	script.Parent.Transparency = 0
        script.Parent.Image.Transparency = 0
	
	StartButton.MouseButton1Click:Connect(function()
		repeat
		script.Parent.Transparency += 0.1
		script.Parent.Image.Transparency += 0.1
		print("Transparency is Changing, Current Transparency is: "..script.Parent.Transparency.."and "..script.Parent.Image.Transparency)
		wait(0.1)
		until script.Parent.Transparency >= 1
		script.Parent:Destroy()
	end)
end)
1 Like

I see, how do I make it fade out then?
Do I use tweens?