How to make pet sim like coin generation?

In pet sim, when the coin spawns it drops to the ground, but doesn’t randomly bounce in any direction(like it does for me) and goes straight up an down instead. How would I replicate this system?

1 Like

If you wanted to use physics for the bounce, you could constrain them with something like a PrismaticConstraint, but then you have to worry about network ownership and so on. I suggest you keep them anchored and just tween (or otherwise animate) them to bounce on the client once they’re added to workspace.

For example:

  1. You create a coin on the server, position it (somewhere on the ground) and make it transparent, then add it to workspace
  2. Have a listener on the client for when a coin is added, once it’s added take note of its positon, move it up by a few studs, make it visible, then tween its position down to the original using the Bounce easing style

I say to move it up on the client so there’s no discrepancies if you’re listening to Touched events on the server for example. If you won’t use anything that might have possible discrepancies, then you can just add them raised up from the ground and non-transparent on the server.

See if Bounce is nice enough for you, and if it’s not then create a custom easing style or bounce function.

Works like a charm! Thank you!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.