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!
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)