Script does not work even though it should

Most certainly

First open a new place in Studio. Then copy (Ctrl-C) the screen Gui in the original place that is causing the trouble. In our case its the screenGui named “Menu” Finally paste the screenGui into the new place you created (if it doesn’t paste try right clicking and selecting “Paste Into”), then save the place and drag the .rblx file onto the reply text box

Hope this helps

dzhann757’s Place.rbxl (624.2 KB)
Don’t mind the other errors, it was a very old place.

Okay after some testing I found out that waiting for the “Sounds” folder and potentially “DisappearSound” were most likely stopping the script from reaching the connection

Anyways this script should work now!

local SoundService = game:GetService("SoundService")
local TweenService = game:GetService("TweenService")

local ExitButton = script.Parent
local SettingsFrame = ExitButton.Parent
local Menu = SettingsFrame.Parent.Parent

local Sounds = Menu.Sounds
local DisappearSound = Sounds.DisappearSound

local debounce = false

ExitButton.Activated:Connect(function()
	print("active")
	if debounce == true then return end
	debounce = true
	
	DisappearSound:Play()
	print("ok!")
	TweenService:Create(SettingsFrame, TweenInfo.new(DisappearSound.TimeLength, Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
	
	for i, v in SettingsFrame:GetDescendants() do
		if v:IsA("Frame") then
			TweenService:Create(v, TweenInfo.new(DisappearSound.TimeLength, Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
		elseif v:IsA("TextLabel") then
			TweenService:Create(v, TweenInfo.new(DisappearSound.TimeLength, Enum.EasingStyle.Linear), {TextTransparency = 1}):Play()
		elseif v:IsA("UIStroke") then
			TweenService:Create(v, TweenInfo.new(DisappearSound.TimeLength, Enum.EasingStyle.Linear), {Transparency = 1}):Play()
		elseif v:IsA("TextButton") then
			TweenService:Create(v, TweenInfo.new(DisappearSound.TimeLength, Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
			TweenService:Create(v, TweenInfo.new(DisappearSound.TimeLength, Enum.EasingStyle.Linear), {TextTransparency = 1}):Play()
		end
	end
	
	task.wait(2)
	debounce = false
end)

Wait but how though? The sounds folder and disappear sound are outside of the connection. Did they not load fast enough? :thinking:

Okay so doing some more diggin I was completely wrong… sorry about that.

Whats actually happening is that whenever you click the exit button on the SettingsFrame, its actually activating the exit button on the InfoFrame hence why you heard the closing sound but nothing was printing out, this is beacuse the InfoFrame is on top of the SettingsFrame,

To fix this set both InfoFrame and SettingsFrame’s Interactable to false, then whenever the Gui is opened set it to true, and whenever it closed set it false

Ohhhhh alright. I get it now. But why would it activate InfoFrame’s exit button though? If the transparency is 0 then it shouldn’t be interactable right?

Nope it used to be the case, but recently they changed it so now you’re just setting the transparency of the Frame, not if a player can interact with it

Wait when did they change that? I swear it did work before.

Let me go re-write my code real quick. I will test it when it’s done.

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