I’ve been having an issue with a script I have that moves a joystick which is on a moving platform. When both the platform and the joystick have PivotTo() called on them (causing the joystick to move twice) the joystick begins deforming itself. Here’s an image when the game first starts:

and here’s an image of the joystick after the platform and itself have moved:

Finally: Here’s an image from after the platform has been sent back and forth numerous times:

Here’s the code:
function manageJoystick(dt,pos:Vector2)
local joystick = hVeh.Controls.Joystick
joystick.Stick:PivotTo(joystick.Joint.CFrame * CFrame.Angles(0,math.rad(pos.X)*30,math.rad(pos.Y)*30))
end
function moveCrane(dt,pos:Vector2)
x += dt * speed * pos.Y
z += dt * speed * -pos.X
veh:PivotTo(origin * CFrame.new(0,0,x))
hVeh:PivotTo(veh.PrimaryPart.CFrame * HCarriageOffset * CFrame.new(z,0,0))
end
connection = rs.Heartbeat:Connect(function(dt)
local F = uis:IsKeyDown(Enum.KeyCode.Up)
local B = uis:IsKeyDown(Enum.KeyCode.Down)
local L = uis:IsKeyDown(Enum.KeyCode.Left)
local R = uis:IsKeyDown(Enum.KeyCode.Right)
local inp = Vector2.new((R and 1 or 0) - (L and 1 or 0), (F and 1 or 0) - (B and 1 or 0))
pos = ((pos - inp)/1.1)+inp
moveCrane(dt,pos)
manageJoystick(dt,pos)
end)
My best assumption of what is happening here is some sort of floating-point error, but I’m not entirely sure. If anyone knows how this could be fixed, let me know!
Thanks