How can I make it so you can not click Buttons inside the background when the Frame is opened

Hello! How can I make it so if you have a frame opened, you can not press any button inside the background, whenever I click on my teleport thingy, and the frame shows up, I can still click all the buttons inside the background. How can I fix this?

Any help will be appreciated! :grinning_face_with_smiling_eyes:

My script

-- Functions
local player = game:GetService("Players").LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local Player = game.Players.LocalPlayer
local Character = Player.Character
-- Disable walking Functions
local players = game:GetService("Players")
local player = players.LocalPlayer or players.PlayerAdded:wait()
local character = player.Character or player.CharacterAdded:wait()
local humanoid = character:WaitForChild("Humanoid")
-- Delay Click Function
local db = false
-- when you click the button
script.Parent.MouseButton1Click:Connect(function()
	if db == false then
		db = true
	script.Disabled = false
-- See if you own the door
	if Player.Doors[script.Parent.Name].Value == true then
		Character.HumanoidRootPart.CFrame = game.Workspace.DoorsKeys[script.Parent.Name].CFrame
		local debounce = false
			if debounce == false then
			debounce = true
-- disable the walkspeed
			do
				humanoid.WalkSpeed = 0
				humanoid.JumpPower = 0
				
			end
-- Opens the Loading World frame

				game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
			playerGui.LoadingWorld.Frame.Visible = true
			
			-- Change Text to Loading...
			playerGui.LoadingWorld.Frame.TextLabel.Text = "Teleporting to Snowy Fields"
			wait(0.5)
			playerGui.LoadingWorld.Frame.TextLabel.Text = "Teleporting to Snowy Fields."
			wait(0.5)
			playerGui.LoadingWorld.Frame.TextLabel.Text = "Teleporting to Snowy Fields.."
			wait(0.5)
			playerGui.LoadingWorld.Frame.TextLabel.Text = "Teleporting to Snowy Fields..."
			wait(0.1)
			-- The Position when it's done
				playerGui.LoadingWorld.Frame:TweenPosition(UDim2.new(1, 0, 0, 0),"InOut","Sine",1, false, function()
					playerGui.LoadingWorld.Frame.Visible = false
					playerGui.LoadingWorld.Frame.Position = UDim2.new(0, 0, 0, 0)
					game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
			end)   
			wait(1)
-- reenable walk speed
			do
				
				humanoid.WalkSpeed = 16
				humanoid.JumpPower = 50
				
			end

				task.wait(1)
				debounce = false
			end	
-- If you do not own the location
	else
		script.Parent.TextLabel.Text = "You do not own this Location"
		wait(0.85)
		script.Parent.TextLabel.Text = "Snowy Fields"
	end
-- Makes sure it is fully done
	wait(0.2)
	script.Disabled = false
-- Does Delay
	wait(0.01)
	db = false
	end
end)

That layer thing is a bug and has been a bug for a long time, you didn’t do anything wrong.

To solve it, put a button inside of that new frame, size it 1,0,1,0, make its BackgroundTransparency and TextTransparency properties 1, and make its ZIndex very low, like -999 or something.

1 Like

So I did that and I seem to can still click everything behind it? What I mean: 2021-10-27 21-45-09
(I think I did a imagelabel, lemme fix it.)

UPDATE: Yea I did, it works now! Thank you!

1 Like