How can i make a pet follow the mouse when equipped?

I already get the pet while summoning, so how can i make it follow the mouse when equipped? I already tried with render stepped but that can cause much lag, and i don’t want the game to be heavy, so how can i do that?

To facilite, i have a tag on the tools, and the tag’s name is “Pet”.

1 Like

You could use Mouse.Moved function which every time it is fired lerps it to the mouses position. Also when you use renderstep it shouldn’t be that laggy i used it today for moving a model and there was basically no lag, I have experienced it lagging and it was because the priority was too low or something else effecting it.

3 Likes

For some reason, i already tried and it didn’t worked for some reason, can you give me an example code? (also i don’t want to put each individual script in each pet)

1 Like

I will I just have to type it cus I’m on mobile so I’m slow.

2 Likes

oh ok, i understand how it is.

1 Like

Sorry I cant give you an example code but I can explain how to do it. So I recommend you use for loop looping through your folder where you store your pets(if you have a folder), then you want use your lerp function here is a video on how it works:

Point A will be your starting position which is the pet.CFrame and point B will be mouse.Hit this should all be in the function mouse.moved

2 Likes

Thank you, im gonna try that, i hope it will work.

1 Like

Btw with renderstep i believe your problem is priority I remember fixing my laggy renderstep by changing its priority you can do this by using the function bindToRenderStep and using Enum.renderstep priority and selcting which priority it should Match to it a bit more complex but that’s the basics.

2 Likes

k, i’m gonna try that later, lemme try the lerp thing first

1 Like