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

Shop Opening By Clicking Key?

Asked by 9 years ago
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local GUI = script.Parent.MainGUI
Mouse.KeyDown:connect(function(key)
    if key == "f" and GUI.Visible == false then
        GUI.Visible = true
    elseif key == "f" and GUI.Visible == true then
        GUI.Visible = false
end
  end)

For some reason, ROBLOX only recognizes LocalPlayer, and Player1 (The Test For Roblox Studio) what should I use to replace LocalPlayer, so that everyone can open the shop?

0
Put it into a codeblock by clicking the Lua icon, then putting the code in between the squiggly lines. Simply edit your answer underneath your player on the right side. SlickPwner 534 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse() 
local GUI = script.Parent.MainGUI.Frame

Mouse.KeyDown:connect(function(key)
    if key == "f" then 
        GUI.Visible = not GUI.Visible
    end 
end)

You were calling on the GUI, not the frame inside. The GUI object is to hold the GUI elements. If everything is messy in the GUI then just put it in a frame that fits the whole screen.

0
no, MainGUI is the name of the frame User#6200 10 — 9y
Ad

Answer this question