Hey, guys. I am trying to make a script that finds every single Billboard Gui inside a player's PlayerGui using ClassName, and making them enabled when the player presses the 'e' key. I tried the following inside a localscript, inside the StarterPack, but it doesn't seem to be working. If anyone can teach me the answer to this problem, I would gladly appreciate it!
Player = script.Parent.Parent mouse = Player:GetMouse() function onKeyDown(key) key = key:lower() if script.Open.Value == false then if key == "e" then gui = Player.PlayerGui for _, gui in ipairs(part:GetChildren()) do if gui.ClassName == 'BillboardGui' then gui.Enabled = true end end end end end mouse.KeyDown:connect(onKeyDown)
You never defined 'part' as used in line 9. Also, for the ClassName, I would do
if gui:IsA("BillboardGui") then
The correct ClassName is "BillboardGui" not "Billboard Gui".
Well, if it were to show up, it'll have to be in a block. And it needs a TextButton or TextLabel inside of it.