?Hi and thank you for looking at my question, I made a pause menu which where it'll open if you press down a certain key, but it isn't working. Not one bit, here's the code of Lua that I made for this.
repeat wait() until game.Players.LocalPlayer local p = game.Players.LocalPlayer local m = p.GetMouse () local folder = p.PlayerGui:WaitForChild("Pause Gui") local guitoopen = folder ["StarterGui"] m.KeyDown:conect(function(key) if key: lower() == "p"then if guitoopen.Visible then guitoopen.Visble = false else guitoopen.Visible = true end end end)
I have no idea why it is acting this way. So If you can help me, that'll be great!
The issue here is that you have a few typos. However, you shouldn't use KeyDown in the first place because it's deprecated. Use UserInputService instead.
game:GetService("UserInputService").InputBegan:connect(function(key) --Triggered on an input if key.KeyCode == Enum.KeyCode.P then --If the input is P then if guitoopen.Visible then guitoopen.Visible = false else guitoopen.Visible = true end end end)
EDIT: I believe there's a problem with how you defined guitoopen. If folder is the Pause GUI, how can guitoopen be folder["StarterGui"]? That would require the Pause GUI to be the StarterGui parent, which is not possible.