#Moving a model and all the parts together

1 messages · Page 1 of 1 (latest)

crude field
#

So right now I have a model which is a pet, and inside the pet model more model for like ears and what not. How do i move them all together when using tween service?

function petAnimation()
    local Hatchedpet = getRandomPet()
    if not Hatchedpet then return end

    Hatchedpet.PrimaryPart.CFrame = PetSpawn.CFrame

    local targetPosition = dropPet.Position

    local moveTweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
    local moveGoal = {Position = targetPosition}
    local moveTween = TweenService:Create(Hatchedpet.PrimaryPart, moveTweenInfo, moveGoal)

    moveTween:Play()
    moveTween.Completed:Wait()
end```
oak hinge
#

try tweening cframe

crude field
oak hinge
#

rather than Position = do
CFrame = CFrame.new(targetPosition)

crude field
#

your such a legend

#

i spent so long on this and its so simple

#

wow thanks

oak hinge
#

its ok

crude field
#

one more thing

#

do you know how to ignore the rotation of the part im going to?

oak hinge
#

wdym

crude field
#

let me show you one sec

oak hinge
#

CFrame = CFrame.new(targetPosition,arg2)
in arg2 u can put a position that you want the part to look at

crude field
#

and i need to scale it

#

no clue how to do that

#

can you help me with that by any chance?

oak hinge
#

what do you want it to be facing?

#

or do you want it to already be facing

#

the thing

crude field
#

but i was thinking of making it look more random of a spin while its turning

#

if that makes sense

oak hinge
#

yeah

#

youd have to set its orientation to like look to the left

#

then in the cframe tween just give it a position in arg2 and it will look at that position

#

you can probally just give it an offset from its tweeningcframe

crude field
#

yeah okay that makes sense so just {CFrame = CFrame.new(targetPosition, Vector3.new(0, 0, 0))}

#

i think thats how you do it

#

then how could i scale the whole pet?

#

like set its size to a certain size

#

this is how its layout is right now btw there is multiple mesh

#

@oak hinge

oak hinge
#

divide its size then times it in a tween by the amount you divded?

crude field
#

@oak hinge

#
function spawnPet()
    local newPet = getRandomPet():Clone()
    newPet.Parent = game.Workspace
    
    for _, v in pairs(newPet:GetDescendants()) do
        if v:IsA("BasePart") then
            v.CFrame = PetSpawn.CFrame
        end
    end

    --newPet:SetPrimaryPartCFrame(CFrame.new(newPet.PrimaryPart.Position, Vector3.new(0, -90, 0)))
    
    --task.wait(3)

    return newPet
end

function petAnimation()
    local Hatchedpet = spawnPet()
    if not Hatchedpet then return end

    Hatchedpet.PrimaryPart.CFrame = PetSpawn.CFrame

    local targetPosition = dropPet.Position
    local targetAngle = dropPet.Orientation

    local moveTweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
    local moveGoal = {CFrame = CFrame.new(targetPosition, targetAngle)}
    local moveTween = TweenService:Create(Hatchedpet.PrimaryPart, moveTweenInfo, moveGoal)

    moveTween:Play()
    moveTween.Completed:Wait()
end```