But the problem with this is that the pet will vibrate back and forth when the player moves, shown in the video below:
You can see that the pet jitters a little bit fowards and a bit backwards when the player walks, but in pet sim the pet walking animation looks like this:
You can see that theres no jittering and its movement is very smooth, I have no idea how to achieve this.
Thanks a lot for the help!
Hey there,
the model was nice and I tested it but it wasn’t exactly what I was looking for because sometimes when the player turns the model doesnt follow behind it
Thanks a lot for the help thougfh
No problem; Sorry that it didn’t end up being the solution, though!
I am not very familiar with pet systems but I believe that these sorts of effects are generally handled on the client-side so it’s more responsive and less likely to cause a strain on the server.
If you swap it to being run via a LocalScript and the jitteriness doesn’t immediately go away, consider updating the code within your original post from using Heartbeat to use other events, such as RenderStepped, to see if that makes any difference.
Or you could experiment with each of the RunService Events to see which one ends up having the best results for your use case.
no, since it runs on the client, just on every other client, which is the same as running on the server, you just use the resources locally
the problem is probably coming from the fact that the player seems to be jittering too ? the CFrame is probably calculated at the exact degree so maybe using math.round() or something in the likes would help ?
i would need to see the entire script to be able to solve this properly
I understand but it means that other players won’t be able to see the pet moving, and using FireAllClients for every frame seems it would take a much heavier toll on the server
There is aboslutely no toll on the server if the pet movement runs on the client, since your own computer does the calculations. Not the server. You can freely use :FireAllClients without worrying about performance issues. Every FPS game replicates shots using :FireAllClients (or else the shots would lag) and you can imagine how many shots per second happen in a full server, either way the game runs like butter. There is no lag, there will be no performance issues, there will be no huge memory usage. I dont think there is a better solution for your problem, but you choose.
My guess is they created a custom rig with a humanoid and did humanoid:MoveTo()
You’ll probably want them to ignore obstacles somewhat, so teleporting if they get too far away is a good idea.
To get a world position based on your character, you can do HumanoidRootPart.CFrame:PointToWorldSpace(PetPosition)
Where PetPosition is the the localized position relative to the character. Probably something like Vector3.new(0,0,10). And then for two pets you could use Vector3.new(2,0,10), Vector3.new(-2,0,10)
That way your many pets will know where to go.
Here’s a link for a rig editor:
After creating a custom rig for your pet, you can animate it with a walk animation and idle animation.