Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make my script properly find the players mouse? player:GetMouse() [closed]

Asked by 5 years ago
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?