player = script.Parent.Parent.Parent mouse = player:GetMouse() invBox = game.StarterGui.ScreenGui.Frame local open = false function inv(key) key = key:lower() if key == "p" then if open then player.PlayerGui.ScreenGui.Frame.Visible = false -- You can change "Frame" or "ScreenGui" to your Gui's name(s) open = true open = false return end if not open then player.PlayerGui.ScreenGui.Frame.Visible = true -- You can change "Frame" or "ScreenGui" to your Gui's name(s) open = true end end end mouse.KeyDown:connect(inv)
If I were to put the script into PlayerScripts then it would work just fine
if I make player = script.Parent.Parent
Closed as Not Constructive by TheeDeathCaster
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?