I’m Padrox and I’m learning how to make an advanced pet system with animated pets and a lot more things !
I already made an equip system with an inventory and I already scripted the sample of code to make the pet follow the player using AlignPosition and Orientation.
I scripted another feature wich make the pet look the plr when he is Idle and when he is moving like this:
Now I’m trying to make a floating animation for my pets to make it more dynamic like in a lot of huge game like Bubble Gum Simulator.
I don’t think they added a humanoid into their pets and rigged all parts to make an animation with the animation editor or with the moon animation editor and then play the animation.
I first thought about Tweening the attachment.CFrame of the pet but I don’t know what is the best way to do this.
It’s why I’m here to share my reflexions with you guys,
I use BodyMovers. One BodyPosition and one BodyGyro in combination.
I multiply the HRP CFrame by a vector to transform local offset to world space and apply it to the BodyPosition, and I simply assign the HRP CFrame to the BodyGyro. All in a loop which runs ~ 10 times per second in a LocalScript.
If you go this way, it’s also important that you set the Network Ownership of the pet parts to the player. If you don’t, the server or other clients might gain control over the parts and since the properties of the BodyMovers don’t replicate from the client the pet would fly towards whatever position the BodyMover initially had set.
Manipulating CFrames manually is not a good idea. To ensure smooth animation in the first place, you’d have to animate it on every client separately at the cost of performance.