How can I make a GUI that can be cycled using a button on your keyboard

Hello there,

I have a question. How can I make a UI where you press a button on your keyboard to cycle through it. For example, you press the right arrow to cycle to the GUI to the right side? Thank you.

Important Information: If this is considered asking someone for code or a script then, please let me know so that I can delete this topic.

1 Like

I can make a script for you but its only moving for one button [with key arrows]

Well, I don’t know if that’s allowed because in the rules, it says that you can’t ask for code or ask someone to do a code for you.

Everyone does that
its allowed

Well, just because somebody does something that breaks the rules that doesn’t mean that It’s allowed like for example, if everybody hacks each other’s account, that doesn’t mean that hacking is allowed.

Man this is called Scripting support

btw here you go :wink:

--Put inside TextButton/ImageButton
local UIS = game:GetService("UserInputService")
local Keys = {
	Up = Enum.KeyCode.Up;
	Left = Enum.KeyCode.Left;
	Right = Enum.KeyCode.Right;
	Down = Enum.KeyCode.Down
}
local ButtonToMove = script.Parent 

UIS.InputBegan:Connect(function(input)
	local LocaleKeycode = input.KeyCode
	if LocaleKeycode == Keys.Up then
		ButtonToMove.Position += UDim2.fromScale(0,-0.1)
	elseif LocaleKeycode == Keys.Left then
		ButtonToMove.Position += UDim2.fromScale(-0.1,0)
	elseif LocaleKeycode == Keys.Right then
		ButtonToMove.Position += UDim2.fromScale(0.1,0)
	elseif LocaleKeycode == Keys.Down then
		ButtonToMove.Position += UDim2.fromScale(0,0.1)
	end
end)

Is it good/ Does it work? [limit]

I haven’t tried it yet, hold on please.

So?
.
.
.
.
[character limit; ignore]

How do you even set this up? I’m confused.

Okay so put this inside a TextButton.
put in a localscript
Then You can change the keys from “up left right down” to w a s d or what u want. then you can play test and the button will move as the keys are pressed

If it worked please solution the post or else people will come to help while its already done. ty :slight_smile:

Hey I know I’m not the guy that asked, but yes the script does work

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.