I need some help with tweening models

I’ve been stuck on this part for a while now, but what im trying to do is make the 'Minion rotate and move to a specific location that I’ve labeled on the model itself, but i cant figure it out so i’m stuck with a sample of someone’s code and for some reason it doesnt even allow me to rotate and move it at the same time… Can someone help me??
Heres the errors I’m getting


The Code:

local DropperTemp = game.ServerStorage:WaitForChild('DropTemp1')
local minion = script.Parent.MinionV1
local TS = game:GetService('TweenService')

local Pt1 = script.Parent.Pos1
local Pt2 = script.Parent.Pos2

local PrimaryPt = minion.PrimaryPart

for _, partz in pairs(minion:GetChildren()) do
	if partz:IsA('BasePart') or ('UnionOperation') and not (partz == PrimaryPt) then
		local Weld = Instance.new('WeldConstraint')
		Weld.Part0 = partz
		Weld.Part1 = PrimaryPt
		Weld.Parent = Weld.Part0
		
		partz.Anchored = false
	end
end

PrimaryPt.Anchored = true
PrimaryPt.CanCollide = false

local tweenInfo = TweenInfo.new(
)

local move1 = TS:Create(PrimaryPt,tweenInfo, {CFrame = PrimaryPt.CFrame * CFrame.Angles(0, math.rad(180), 0), PrimaryPt.CFrame + Vector3.new(1.6,0,5)})

local function Animate()
	move1:Play()
end

while task.wait(10) do
	
	Animate()
	local NewDrop = DropperTemp:Clone()
	NewDrop.CFrame = script.Parent.DropPart.CFrame
	NewDrop:SetAttribute('CashToGive', script.Parent:GetAttribute('Value'))
	NewDrop.Parent = script.Parent.Drops
end

This is what the old script did…
https://gyazo.com/c935998260ff3187aa0ef16ab2027bdb

1 Like

You have a comma in your properties for the tween add your vector after your primarypart cframe just replace your properties with this {CFrame = PrimaryPt.CFrame + Vector3.new(1.6,0,5) * CFrame.Angles(0, math.rad(180), 0)}


getting an error

whats could you send me the error?

1 Like

oh my bad replace vector3.new with cframe.new

Change it to CFrame insteadf of Vector3


Try change the 1st argument to cframe, then the 2nd to a vector3.

replace your + with * you cant add vector3 onto cframe

2 Likes

Thank you so much bro! It finally works now!!

1 Like

oh yeah btw would it be possible at all to make it so that the ‘minion’ uses the CFrame and the Orientation of the Position blocks I made? or no?

im not sure what you’re asking me could you give me some more context?

image

image

Would it possible that instead of manually setting up the movent, i could just use these 3 parts as my references in the code so that the ‘minion’ just walks to it and rotates the same way they are rotated. Does this make sense? Sorry my brain is fried

You need to create 2 tweens for each block and set the tween CFrame to the blocks CFrames, then you can create a while loop to keep this going infinitely but make sure to add tween.Completed:Wait() so the other tween doesn’t start before the first one is finished.

local Tween1 = TS:Create(PrimaryPt, tweenInfo, {CFrame = Pt1.CFrame})
local Tween2 = TS:Create(PrimaryPt, tweenInfo, {CFrame = Pt2.CFrame})

task.spawn(function()
	while task.wait() do
		Tween1:Play()
		Tween1.Completed:Wait()

		Tween2:Play()
		Tween2.Completed:Wait()
	end
end)

would this work with the rotation too?

yes because you’re getting the cframe which already contains the rotation of the part

let me try it out and ill let you know if theres any errors, thank you for keep helping me with this!

1 Like

It works man! You’re the best man on this forum! You’re an absolute legend!

1 Like

https://gyazo.com/a26610e05416a9ef10cb1f8a680f4b23
End Result thanks to @aladdin7127 :heart: