i am having trouble using UserInputServices’ mouseMovement to move a part on a line. it doesn’t follow where the mouse moves and the increments are way different to coordinates on the workspace
local UIS = game:GetService("UserInputService")
local part = Instance.new("Part")
local pos = Vector3.new(0,3,-35)
part.Parent = workspace
part.Position = pos
part.Anchored = true
UIS.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
local x = input.Position.X / 48
part.Position = Vector3.new(x, pos.Y, pos.Z)
print(input.Position)
print(part.Position)
end
end)
here is the code i tried, im not sure if there should be specific math i should use or another service/function
(i used 48 since that is the size of the path that i want the part to follow)