Please help, I'm trying to get a GUI to open when a tool is selected but it isn't opening at all. :-(
I get this error when I open the tool: OpenGUI:9: Attempt to index local 'gui' (a nil value), Line 9 - global LoadGui, Line 23
And this error when I close the tool: BenOVGui is not a valid member of PlayerGui, Line 18 - global UnloadGui, Line 18, Line 27
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
function LoadGui()
repeat wait() until player.Character
if not player.PlayerGui:FindFirstChild("BenOVGUI") then
local cgui = game:GetService("ReplicatedStorage"):WaitForChild("BenOVGUI")
gui = cgui:Clone()
gui.Parent = playerGui <--
print("Gui placed in ".. player.Name)
else
player.PlayerGui.BenOVGUI.Enabled = true
print("Gui Enabled.")
end
end
function UnloadGui()
playerGui.BenOVGUI.Enabled = false <--
print("Gui Disabled.")
end
script.Parent.Parent.Equipped:connect(function()
LoadGui() <--?
end)
script.Parent.Parent.Unequipped:connect(function()
UnloadGui() <--?
end)

5 comments
Please help?
When I ran the code, it worked perfectly fine. Try restarting studio maybe.
Really? In studio it shows no errors and does nothing. In game, it shows those errors.. :/
I just tried it in game and it works fine too.
I'm using Adonis Admin and it screwed with the way I had it before. I'm getting the errors with it but I really like the admin. If you add it in you'll get the errors.