AridOats
(Arid)
February 12, 2021, 8:34pm
#1
Hello,
I’m trying to open a Frame in a GUI by pressing “q”, what am I doing wrong in the big code below? (DW, most of it is Constants.)
local currentPage = full.CurrentPage
local pagesList = full.Pages
local topBar = full.Topbar
local divider1 = full.dividers.Frame1
local divider2 = full.dividers.Frame2
local mouse = game.Players.LocalPlayer:GetMouse()
local gui = script.Parent
mouse.KeyDown:connect(function(key)
if key == "q" then
full:TweenSize(
UDim2.new(0, 618,0, 395),
Enum.EasingDirection.In,
Enum.EasingStyle.Sine,
2,
true
)
wait(2)
close.Visible = true
pagesList.Visible = true
divider1.Visible = true
divider2.Visible = true
end
end)
Thanks, AridOats.
4 Likes
Aerosphia
(Aero)
February 12, 2021, 8:35pm
#2
1 Like
Blizzero
(Blizzero)
February 12, 2021, 8:37pm
#3
Adding on to @Aerosphia , you may also want to consider using the ContextActionService | Documentation - Roblox Creator Hub . While it is a bit harder to figure out at first, players will likely find it very useful in preventing unwanted menus from opening while chatting!
AridOats
(Arid)
February 12, 2021, 8:37pm
#4
ok, thankyou!
So, what would I change to what, exactly? Sorry, I’m not… fully sure…!
[EDIT] actually, I’ve figured it out now, sorry, thanks again!
Aerosphia
(Aero)
February 12, 2021, 8:39pm
#5
As an example. (this isn’t tested, correct me if I’m wrong)
userInput.InputBegan:Connect(function(input,gameProcessed)
if gameProccessed then -- Prevents this from running when typing in chat
if input.KeyCode == Enum.KeyCode.Q then
end
end
end)
8 Likes
AridOats
(Arid)
February 12, 2021, 8:42pm
#6
hey, so gameProccessed
is Undefined, what is it that I can do to Define this?
Aerosphia
(Aero)
February 12, 2021, 8:43pm
#7
You’re spelling it wrong. If you’re spelling it as “gameProccessed”, it should be changed to gameProcessed
.
But first you have to do
local UserInputService = game:GetService(“UserInputService”)
local Frame = game.StarterGui.ScreenGui.Frame
UserInputService.InputBegan:Connect(function(input, gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.Q then
Frame.Visible = true
end
2 Likes
Oh sorry, sometimes it’s hard to write code into Non-IDE’s