I want to move the gui in the direction where I press. For example, W would be up. I know the code would look like this.

  1. function onKeyPress(inputObject, gameProcessedEvent)
  2. if inputObject.KeyCode == Enum.KeyCode.W then
  3.  position.GUI X + 0.01
    
  4. end
  5. end
  6. game:GetService("UserInputService").InputBegan:connect(onKeyPress)

Please help. Thank you!

2 comments

0

This isn't an answer, but to neaten up your code you can open up a code block by pressing the blue lua button (located on the taskbar above the text box and below the title) and inputting your script in between the ~'s that pop up!

0

Thanks!