local function IsBeingPressed()
local MovingUp = false
local MovingDown = false
local MovingLeft = false
local MovingRight = false
if Setting == "Arrows" then
if UIS:IsKeyDown(Enum.KeyCode.Up) then MovingUp = true end
if UIS:IsKeyDown(Enum.KeyCode.Down) then MovingDown = true end
if UIS:IsKeyDown(Enum.KeyCode.Left) then MovingLeft = true end
if UIS:IsKeyDown(Enum.KeyCode.Right) then MovingRight = true end
elseif Setting == "WASD" then
if UIS:IsKeyDown(Enum.KeyCode.W) then MovingUp = true end
if UIS:IsKeyDown(Enum.KeyCode.S) then MovingDown = true end
if UIS:IsKeyDown(Enum.KeyCode.A) then MovingLeft = true end
if UIS:IsKeyDown(Enum.KeyCode.D) then MovingRight = true end
end
return MovingUp, MovingDown, MovingLeft, MovingRight
end
local MoveSpeed = 10
RS.RenderStepped:Connect(function()
local MovingUp, MovingDown, MovingLeft, MovingRight = IsBeingPressed()
local FuturePos = Plr.Position
FuturePos = Vector2.new(FuturePos.X.Offset, FuturePos.Y.Offset)
if MovingUp then FuturePos = Vector2.new(FuturePos.X, FuturePos.Y - MoveSpeed) end
if MovingDown then FuturePos = Vector2.new(FuturePos.X, FuturePos.Y + MoveSpeed) end
if MovingRight then FuturePos = Vector2.new(FuturePos.X + MoveSpeed, FuturePos.Y) end
if MovingLeft then FuturePos = Vector2.new(FuturePos.X - MoveSpeed, FuturePos.Y) end
if IsInBounds(FuturePos) then Plr.Position = UDim2.new(0, FuturePos.X, 0, FuturePos.Y)
end)
The title. The player’s character gui moves fine in diagonals as well, but if you hold down both arrowLEFT and arrowRIGHT to cancel eachother out, then hold arrowUP it does nothing. UIS doesn’t even register you pressing arrowUP, what is even more confusing is that holding arrowDOWN will make it move as expected and it will go down.
If you hold arrowUP before holding LEFT and RIGHT, it will act as expected tho, moving up
Something similar happens with WASD setting - if you hold W and S, cancelling eachother out, it won’t register you pressing either A or D
Is this an issue from roblox or with the script itself? Has this happened to anyone else?
Thanks,
Hokker3