I tested and i have to tween cframe because the rest of the model doesn’t follow if i tweened position instead even though its welded
i have it so it rotates when i press r
but when i move the model the rotation gets reset
also if i spam r the rotation gets messed up for some reason
--code for rotation
if input.KeyCode == Enum.KeyCode.R then --rotate model
local tween = TweenService:Create(model.PrimaryPart, tweenInfo, {CFrame = model.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(90), 0)})
tween:Play()
return
end
--code for mouse position
local raycast = getRay(input.Position)
if raycast then
local tween = TweenService:Create(model.PrimaryPart, tweenInfo, {CFrame = CFrame.new(raycast.Position)})
tween:Play()
end
What about instead of using Tweens for that task, just use RunService.RenderStep and change the current CFrame position and rotation over time independently with mouse and R key?
Totally agree with that. Thats a reason why I still using Tweens on many projects. But, in your case I sense that the amount of Tweens created per movement of mouse could be a little intensive, so trying RunService/Lerp approach could be helpful.
Specially when its possible to simulate Easing style/direction when using RunService and Lerping CFrames. For example check this Module which creates the easing by using lerp
If you just divide the timeElapsed by the totalTime, you will get a number between 0 and 1 which can be passed to tweenService:GetValue. This can be used to get easing styles easily without writing your own easing funcs/using a module.