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
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
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)}
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)