how do i make it so that when i click a button on my keyboard it open/closes the GUI.
Anyone knows how to do that?
Anyways, thanks
Aesthethic.
how do i make it so that when i click a button on my keyboard it open/closes the GUI.
Anyone knows how to do that?
Anyways, thanks
Aesthethic.
its cool, but it sounds like your asking for someone to create a script which is not what this site is for
anyway here is the script:
local button = script.Parent
local shop = script.Parent.Parent.ShopGUI ---your gui
local sound = game.ReplicatedStorage.SoundEffects.ClickSound ---a sound effect if you have one
local debounce = false
button.MouseButton1Up:Connect(function()
if shop.Visible == false then
shop.Visible = true
elseif shop.Visible == true then
shop.Visible = false
end
sound:Play()
end)
shop:GetPropertyChangedSignal("Visible"):Connect(function()
if shop.Visible then
button.Text = "CLOSE" --- change this to the text of your text button when it closes
else
button.Text = "SHOP" --- change this to the text of your text button when it opens
end
end)
oh yeah i forgot to say put this in a local script inside the button like this:
ah though this is when you click the button with your mouse. I hope this helped you!!
by the means of the keyboard of user input service
game:GetService("UserInputService").InputBegan:Connect(function(input, gpe)
if not gpe and input.KeyCode == Enum.KeyCode.B then
--code
end
end)
how do i make it so that if i click the keycode again then it closes?
game:GetService("UserInputService").InputBegan:Connect(function(input, gpe)
if not gpe and input.KeyCode == Enum.KeyCode.B then
gui.Visible = not gui.Visible
end
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.