local uis = game:GetService("UserInputService") uis.InputBegan:Connect(function(inp) if inp.KeyCode == Enum.KeyCode.L then script.Parent.Position = script.Parent.Position + UDim2.new({0.5, 0},{0, 0}) end end)
I know for sure that it's this line that it stops at after troubleshooting with print()
script.Parent.Position = script.Parent.Position + UDim2.new({0.5, 0},{0, 0})
What can I do to fix this, or is there any better solution to this issue? My current goal is to make an ImageLabel move with the hit of a key, preferably by adding more to the position as I am trying to make a movable 2d character.
Upon further inspection, this appears to be due to the fact that UDim2.new({0.5, 0},{0, 0})
is still seen as {0,0},{0,0}.
Example output from my testing provided below:
> print(UDim2.new({0,0},{0,5})) {0, 0}, {0, 0} > print(UDim2.new(0,5,0,5)) {0, 5}, {0, 5}
You can resolve this issue by using script.Parent.Position = script.Parent.Position + UDim2.new(.5,0,0,0)
instead.