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 10 years ago
01local player = game.Players.LocalPlayer
02local Mouse = player:GetMouse()
03local GUI = script.Parent.MainGUI
04Mouse.KeyDown:connect(function(key)
05    if key == "f" and GUI.Visible == false then
06        GUI.Visible = true
07    elseif key == "f" and GUI.Visible == true then
08        GUI.Visible = false
09end
10  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 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago
1local player = game.Players.LocalPlayer
2local Mouse = player:GetMouse()
3local GUI = script.Parent.MainGUI.Frame
4 
5Mouse.KeyDown:connect(function(key)
6    if key == "f" then
7        GUI.Visible = not GUI.Visible
8    end
9end)

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 — 10y
Ad

Answer this question