-
What do you want to achieve? So, I am trying to make a script that makes a frame go up, down, left, and right when pressing WASD.
-
What is the issue?
-
What solutions have you tried so far? I’ve tried to have it add and subtract 0.001 from the frame position, but it keeps saying things like, “UDIM expected, got UDIM2” and “UDIM2 expected, got UDIM”. I’ve tried using UDIM, UDIM2 and Vector2, but they all come up as error.
Here’s what I currently have:
local Frame = script.Parent.Frame
local W = Enum.KeyCode.W
local A = Enum.KeyCode.A
local S = Enum.KeyCode.S
local D = Enum.KeyCode.D
local UIS = game:GetService("UserInputService")
local open = false
--What is causing the errors
local YNMove = Vector2.new(0, -0.001) --When W is pressed
local XNMove = Vector2.new(-0.001, 0) --When A is pressed
local YPMove = Vector2.new(0, 0.001) --When S is pressed
local XPMove = Vector2.new(0.001, 0) --When D is pressed
--When W is pressed
UIS.InputBegan:Connect(function(key, gp)
if key.KeyCode == W then
if UIS:GetFocusedTextBox() == nil then
if open == false then
open = true
Frame.Position = Frame.Position.Y + YNMove
end
end
end
end)