Is it possible to animate pets usings scripts?

Hey there I was wondering is it possible to animate pets like BGS using scripts?

Here is my pet

I’m not sure how you are planned to script it, but I think it could possibly support scripts and Localscripts

1 Like

You could always try using lerp.

whats lerp, and how do I use it

https://www.youtube.com/watch?v=Yhg6_2UjtCM That’s how I learned it, but what it is, it’s something similar to tweenservice and what it is used for that I can think of right now is FPS games (ex. the way the arms are on the screen with the gun) (may be wrong but thats how I used it)

Also, you would use it for maybe moving the wings every few seconds.

I want to like smth like bgs pets animation

I don’t know what that is, can you send a video or like a gif?

Ash means that they want to animate something similar to Bubble Gum Simulator’s animation for pets.

Also, answering @Ashp116’s question, yes, it is possible to animate pets via scripts similar to BGS’s system.

You could tween its orientation towards the players head every few seconds, thats what it looked like to me?

So the way I would approach this problem is i’d want to set an exact position (Relative to the player’s character) that the pet “tries” to stay at.

Then I would use a smoothing function to interpolate the position of the pet with the new “target” position.

@Crazyman32 has provided the community with one such framework, as seen here:

I would use this framework and plug in position values to it every renderstep to move the pet, and then from there i’d just have to do the same with an angle, and i’d have my CFrame for the pet.

This is a moderately complex system to be perfectly honest, this is just one way of going about solving it.

I made pet animations very similar to those of bubble gum simulator. I had the client update the pet in heartbeat, using sine functions for the offset of the pets position and the rotation, making the pet bounce and rotate nicely. It looks like this: https://gyazo.com/f3d3d12b25d1b804833154ba7c1be96d

can u help me make that script? I am new to lerping and twening

He cannot tell you the script exactly, but he did just tell you how he did it so I just think you should investigate or trial and error.

Sure! You could try a sine wave if you want it to “bob” up and down. That might be a nice effect. Sine waves are periodic so you don’t need to worry about accounting for when it should go up and down yourself. Just pass the current time as a variable.

Here is an example on how you might do it:

local pet = ...

local time = tick()
local frequency = 10
local amplitude = 1

local yOffset = amplitude * sin(time / frequency)

pet.CFrame = defaultPositionBehindPlayer * CFrame.new(0, yOffset, 0)

Here is a Game Dev specific video utilizing sine waves. His case is similar to what you might want to do (but he animates coins not pets)

5 Likes