How can i make magazine clone when hit the ground

I tried using touch event.it works,but it multiplied and not spawning on top of the surface where the real magazine hit.instead the cloned magazine spawned “inside” the object that real magazine hit.so i was thinking how to make the real magazine clone when hit a surface and make the clonned magazine position sync the real magazine position when hit a surface

I’m surprised nobody replied to this yet.

So, let’s say you have your part. You need to know when it’s touched with the Touched event.

After handling that, you add local clone = mag:Clone() and clone.Parent = workspace. Then, clean up the original magazine with game:GetService("Debris"):AddItem(clone, 30) and mag:Destroy(). This should work if you know how to program it.

Why would you want to do this anyways?
I imagine you want to do this so the magazine stays on the ground after reloading, and you would despawn it after some time, but why clone it AFTER touching the ground?
Couldn’t you just use a cloned magazine to dispense in the first place?

Nonetheless, don’t use .Touched to detect if it landed on the ground.
What if the magazine hits a wall?
It would fire the .Touched event and freeze mid-air (if you anchor it, that is).
What you should do instead is repeatedly measure its AssemblyLinearVelocity until it stays at 0,0,0 for multiple seconds (That way you make sure its staying still for sure).

Afterwards, clone the real magazine, anchor it (or not, if you want it to stay unanchored), and clean up the real one.
If the cloned magazines position isn’t where it should be for some reason, just set its Position to that of the real one.

I forgot about that method. I would’ve added that.

Anyways to add on to this, I would do this all on the client.

1 Like

Yes, the magazine is purely a visual effect so don’t strain the server with it.