Hello, I am unable to disable my Billboard Gui, it is Put into the Players PlayerGui by a local script, but I can’t Disable it from a local script inside of the Billboard Gui
My scripts:
Local script in StarterCharacter (Parents the Gui and other things)
local v1 = game.Players.LocalPlayer
local v2 = game.Workspace:WaitForChild(v1.Name)
local v3 = nil
local v4 = nil
local v5 = game.ReplicatedStorage:WaitForChild("Prompt"):Clone()
--{-0.004, 0},{-0, 0} -- POS
--{1, 0},{1, 0} -- Size
-- {0.25, 0},{0.25, 0} SIZE
--{0.354, 0},{0.374, 0} -- Pos
function Sound1()
local frame = script.Parent
v5.Button:TweenSizeAndPosition(UDim2.new(0.768, 0,0.768, 0), UDim2.new(0.116, 0,0.115, 0), "Out","Quad",.2,true)
local v6 = script.Pop
v6:Play()
wait(.75)
v6:Pause()
end
function Sound2()
v5.Button:TweenSizeAndPosition(UDim2.new(0.72, 0,0.72, 0), UDim2.new(0.119, 0,0.14, 0), "Out","Quad",.1,true)
local v7 = script.Pop2
v7:Play()
wait(.75)
v7:Pause()
end
function DSize()
v5.Button:TweenSizeAndPosition(UDim2.new(0.25, 0,0.25, 0), UDim2.new(0.354, 0,0.374, 0), "Out","Quad",.1,true)
end
v5.Parent = v1:WaitForChild("PlayerGui")
repeat
wait(0.05)
if v1.Character.Humanoid.SeatPart == nil and game:IsLoaded() then
local parts = game.Workspace:GetDescendants()
for _,p in pairs(parts) do
if p.Name == "EPart" then
local Magnitude = (p.Parent.Position-v2.HumanoidRootPart.Position).magnitude
if Magnitude < 5 then --if they are within a certain distance
if v3 == nil then
v3 = p.Parent
v4 = Magnitude
v5.Adornee = v3
v5.Enabled = true
v5.ClosestPart.Value = v3
Sound1()
elseif v3 ~= nil and v3 ~= p then
if Magnitude < v4 then
v3 = nil
v4 = nil
v5.Enabled = false
wait(0.025)
v3 = p.Parent
v4 = Magnitude
v5.Adornee = v3
v5.Enabled = true
v5.ClosestPart.Value = v3
end
end
elseif Magnitude >= 5 or Magnitude >= v4 then
if p.Parent == v3 then
DSize()
wait(.1)
v3 = nil
v5.Adornee = nil
v5.Enabled = false
v5.ClosestPart.Value = nil
Sound2()
elseif v3 == nil then
v4 = nil
v5.Adornee = nil
v5.Enabled = false
v5.ClosestPart.Value = nil
end
end
end
end
else
if game:IsLoaded() then
v3 = nil
v5.Adornee = nil
v5.ClosestPart.Value = nil
v5.Enabled = false
v4 = nil
end
end
until script.Disabled == true
Other Local Script (Inside of the Billboard Gui:
local ProximityPromptService = game:GetService("ProximityPromptService")
local UIS = game:GetService("UserInputService")
local KeyDown = false
local prog = script.Parent.Button.ProgBar
local prog2 = script.Parent.Button
local prox = script.Parent.Button
local prompt = script.Parent
local prompt2 = prompt.Button
function Hide()
prompt.Enabled = false
prompt.Adornee = nil
end
function E()
local Inc = 1/(script.Parent.ClosestPart.Value.E_Event.Configuration.Time.Value/0.2)
if script.Parent.ClosestPart.Value.E_Event.Configuration.Time.Value <= 1 then
script.Parent.ClosestPart.Value.E_Event:FireServer()
script.Parent.Enabled = false
prog.YSize.Value = 0
KeyDown = false
elseif script.Parent.ClosestPart.Value.E_Event.Configuration.Time.Value > 1 then
wait()
repeat
if KeyDown == true and script.Parent.Adornee ~= nil then
if prog.YSize.Value < 1 then --Number value is size of the moving E part
prog.YSize.Value = prog.YSize.Value + Inc
prog:TweenSize((prog.Size + UDim2.new(0,0,Inc,0)), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear,0.2, false,nil)
else
wait()
script.Parent.ClosestPart.Value.E_Event:FireServer()
prog.YSize.Value = 0
KeyDown = false
end
elseif KeyDown == false and script.Parent.Adornee ~= nil then
prog.YSize.Value = 0
prog.Size = UDim2.new(1,0,0,0)
elseif KeyDown == true and script.Parent.Adornee == nil then
prog.YSize.Value = 0
prog.Size = UDim2.new(1,0,0,0)
KeyDown = false
end
wait(0.2)
until KeyDown == false
prog.YSize.Value = 0
prog.Size = UDim2.new(1,0,0,0)
end
end
UIS.InputBegan:Connect(function(Key, Gameprocess)
if Key.KeyCode == Enum.KeyCode.E and not Gameprocess then
KeyDown = true
prompt.Button:TweenSizeAndPosition(UDim2.new(0.650, 0,0.650, 0), UDim2.new(0.176, 0,0.174, 0), "Out","Quad",.2,true)
prog.YSize.Value = 0
prog.Size = UDim2.new(1,0,0,0)
E()
end
end)
UIS.InputEnded:Connect(function(Key, Gameprocess)
if Key.KeyCode == Enum.KeyCode.E and not Gameprocess then
KeyDown = false
prompt.Button:TweenSizeAndPosition(UDim2.new(0.768, 0,0.768, 0), UDim2.new(0.116, 0,0.115, 0), "Out","Quad",.2,true)
E()
end
end)
UIS.InputBegan:Connect(function(Key, Gameprocess)
if Key.KeyCode == Enum.KeyCode.ButtonX and not Gameprocess then
KeyDown = true
prompt.Button:TweenSizeAndPosition(UDim2.new(0.650, 0,0.650, 0), UDim2.new(0.176, 0,0.174, 0), "Out","Quad",.2,true)
prog.YSize.Value = 0
prog.Size = UDim2.new(1,0,0,0)
E()
end
end)
UIS.InputEnded:Connect(function(Key, Gameprocess)
if Key.KeyCode == Enum.KeyCode.ButtonX and not Gameprocess then
KeyDown = false
prompt.Button:TweenSizeAndPosition(UDim2.new(0.768, 0,0.768, 0), UDim2.new(0.116, 0,0.115, 0), "Out","Quad",.2,true)
E()
end
end)
script.Parent.Button.MobileButton.MouseButton1Down:Connect(function()
KeyDown = true
prompt.Button:TweenSizeAndPosition(UDim2.new(0.650, 0,0.650, 0), UDim2.new(0.176, 0,0.174, 0), "Out","Quad",.2,true)
prog.YSize.Value = 0
prog.Size = UDim2.new(1,0,0,0)
E()
end)
script.Parent.Button.MobileButton.MouseButton1Up:Connect(function()
KeyDown = false
prompt.Button:TweenSizeAndPosition(UDim2.new(0.768, 0,0.768, 0), UDim2.new(0.116, 0,0.115, 0), "Out","Quad",.2,true)
E()
end)
Im trying to hide it when the E() function is firared