How can i make GUI button appear after 8 seconds?

Why not just decrease ScreenGui.DisplayOrder (or Element.ZIndex if they’re in the same ScreenGui)

2 Likes

Sure, also sorry for late response.

local TweenService = game:GetService("TweenService")
local Backdrop = script.Parent.Backdrop
local Frames = script.Parent.Frames	

for i = 1, #Frames:GetChildren() do
	local Frame = Frames["Frame" .. tostring(i)]
	if i ~= 1 then
		local Previous = Frames["Frame" .. tostring(i-1)]
		for _, child in Previous:GetChildren() do
			TweenService:Create(child, TweenInfo.new(1.5), {TextTransparency = 1}):Play()
		end
		TweenService:Create(Previous, TweenInfo.new(1.5), {BackgroundTransparency = 1}):Play()
		task.wait(1.5)
		Previous.Visible = false
	end

	Frame.Visible = true
	Frame.BackgroundTransparency = 1
	for _, child in Frame:GetChildren() do
		child.TextTransparency = 1
		TweenService:Create(child, TweenInfo.new(1.5), {TextTransparency = 0}):Play()
	end
	TweenService:Create(Frame, TweenInfo.new(1.5), {BackgroundTransparency = 0}):Play()

	task.wait(1.5 + 2) -- how long to display the frame for
end

task.wait(4)

TweenService:Create(Backdrop, TweenInfo.new(1), {Transparency = 1}):Play()

local Previous = Frames["Frame" .. tostring(#Frames:GetChildren())]
Previous.TextLabel.UIStroke.Enabled = false
for _, child in Previous:GetChildren() do
	TweenService:Create(child, TweenInfo.new(1.5), {TextTransparency = 1}):Play()
end
TweenService:Create(Previous, TweenInfo.new(3), {BackgroundTransparency = 1}):Play()
task.wait(3)
Previous.Visible = false

I think your main mistake was to use a serverscript.

Could you send me a video of what it looks like when you run the game and the intro plays?

I completely understand, but i struggle in implementing the additional part of the script to already working script.

Basically i don’t know where is should put the additional part of the script you guys made.

local music = game.Workspace.Sound.BGM 
local button = script.Parent
playing = true

script.Parent.MouseButton1Click:Connect(function()
	if playing == true then
		music.Playing = false
		button.Text = "🔇" 
		playing = false
	else
		music.Playing = true
		button.Text = "🔊" 
		playing = true
		
		script.Parent.Visible = false
		task.delay(8, function()
			script.Parent.Visible = true
		end)
	end
end)

Also i made a video showing the problem.
Basically the button appears again after 8 seconds.

(Video too big, uploaded to cloud: Screen Recording 2025-02-27 at 17.59.25.mov - Google Drive)

I just send the video. it is in reply for another guy. But heres the link: Screen Recording 2025-02-27 at 17.59.25.mov - Google Drive

From the looks of this video that button is starting off visible. When the Gui “resets” it just shows it like how it was set up. Start it off as set to false. Not in the script in the studio. Then make it Visible, click, not Visible. I have to admit you’re kind of losing me on the 8 second thing.

This visible set to off could still be the way. I don’t know what all you’re doing with this.
Maybe set it to Visible when you’re ready to use it. But start off as not visible…

local music = game.Workspace.Sound.BGM 
local button = script.Parent
playing = true

script.Parent.MouseButton1Click:Connect(function()
	if playing == true then
		music.Playing = false
		button.Text = "🔇" 
		playing = false
	else
		music.Playing = true
		button.Text = "🔊" 
		playing = true
	end

	script.Parent.Visible = false
	task.delay(8, function()
		script.Parent.Visible = true
	end)
end)

Maybe this is what you’re going for … with it set to visible from the start.

Wait a min. “script.Parent.Visible” this should be the button, Is it?
If so why didn’t you just say button.Visible = false or True you have that defined.

2 Likes

Well, I’m not pretty sure what you meant, but i tried this script, and the same thing is happening.

1 Like

I highly doubt that. You’re just struggling with how to get this down.
May as well get used to that, programming is hard. Struggling is par for the course.
When you do figure this out, you’ll never forget it. Embrace the struggle.

2 Likes

You can try setting the ZIndex property of your mute button lower than the intro frames, there is also DisplayOrder properties in Screengui, this way you can ensure that your mute button is below the intro and will not ruin it

1 Like

I will for sure try that really quick!

If you dont mind me asking, where can i find that display order?

Its a property of a ScreenGUI ScreenGui | Documentation - Roblox Creator Hub

1 Like

I tried setting it to 0, and the intro gui to 5, and the button is still there.


If you’re using a LocalScript for handling the intro, you can add a code block at the beginning of your Intro script to hide the music button before the intro starts. This will prevent it from being visible during the intro.

local player = game.Players.LocalPlayer
local musicGui = player:WaitForChild("PlayerGui"):WaitForChild("SoundGui")

musicGui.Enabled = false

Then, at the end of your intro script, you can unhide it by setting musicGui.Enabled property to “true” this time.

2 Likes

I will try to this as soon as possible, I’m now outside.

Thank you so much!! This helped! I’m so thankful!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.