How would I make this code also tween to the targets orientation as well as position?
local tween = ts:Create(prim, TweenInfo.new(2), {Position = Vector3.new(rbp.Position.X, rbp.Position.Y, rbp.Position.Z)})
How would I make this code also tween to the targets orientation as well as position?
local tween = ts:Create(prim, TweenInfo.new(2), {Position = Vector3.new(rbp.Position.X, rbp.Position.Y, rbp.Position.Z)})
You’d either use CFrame to tween position orientation, or you define the orientation too.
goal = {}
goal.Position = Vector3.new(rbp.Position.X, rbp.Position.Y, rbp.Position.Z)
goal.Orientation = Vector3.new(0,90,0)
local tween = ts:Create(prim, TweenInfo.new(2), goal)
Sorry for the extra question, but. When the model tweens everything welded to it doesn’t move, is there a way to fix this?
Are any of the parts attached to it anchored? I haven’t experienced this myself, then again my tweens are usually CFrames, so it also could be a Vector3 thing but I have 0 knowledge on that, don’t quote me.
can I make the vector 3’s in my script to CFrame values?
Yeah, it’d just have to be stated a CFrame, but any vector3 can be input into a CFrame, orientation would have to be calculated alongside the CFrame though.
Yep, you’re correct! Using the Position and Orientation properties causes welds to be adjusted, while CFrame doesn’t. (This is so constraints can be easily adjusted without needing to mess with the C0 and C1 stuff.)
To answer the OP’s question, use CFrame instead of Position or Orientation.
What would it look like if I changed it?
goal = {}
goal.Position = CFrame.new(rbp.Position.X, rbp.Position.Y, rbp.Position.Z)
goal.Orientation = CFrame.new(rbp.Orientation.X, rbp.Orientation.Y, rbp.Orientation.Z)
local tween = ts:Create(prim, TweenInfo.new(2), {CFrame = CFrame.new(rbp.Position)})
If rbp is a part/BasePart you can also do:
local tween = ts:Create(prim, TweenInfo.new(2), {CFrame = rbp.CFrame})
for the position and orientation.