I have the script:
script.Parent.MouseButton1Click:Connect(function()
local JobPanel
if not exists then
exists = true
JobPanel = Instance.new("Frame", script.Parent.Parent.Parent.Parent)
JobPanel.BackgroundTransparency = 1
JobPanel.Name = "Job Panel"
JobPanel.AnchorPoint = Vector2.new(0.5, 0.5)
JobPanel.Position = UDim2.new(0.5,0,0.5,0)
JobPanel.Size = UDim2.new(0,800,0,450)
local Title = Instance.new("TextLabel", JobPanel)
Title.BackgroundColor3 = Color3.new(255,255,255)
Title.Size = UDim2.new(0,750,0,30)
Title.Text = "Job Menu"
Title.TextScaled = true
else
JobPanel:Destroy()
end
end)
But the Destroy() doesn't work because for some reason JobPanel is nil? Help?
Error:
Players.radusavin366.PlayerGui.HUD.MainHUD.Buttons.JobPopup.LocalScript:19: attempt to index local 'JobPanel' (a nil value)
14:44:53.855 - Stack Begin
14:44:53.855 - Script 'Players.radusavin366.PlayerGui.HUD.MainHUD.Buttons.JobPopup.LocalScript', Line 19
14:44:53.856 - Stack End

1 comment
In line 2, you didnt mention what is "local JobPanel". Add "=" after the JobPanel and tell the script what is JobPanel.