Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Need help with shell ejection from gun [?]

So this has been driving me crazy, I still don't understand how to do it right.

Basically this is the current little script I use to make the shell appear to eject:

local Velocity = Instance.new("BodyVelocity", Clone)
Velocity.Velocity = Vector3.new(math.random(4,16), math.random(4,16), 0)

Nothing special and was quickly coded to save time, BUT, the problem with it is that.. this happens:

https://gyazo.com/144110334b1805ef124ff5db6a74ba10

You can clearly see that the bullet is ejecting in only one direction, which makes it look weird, how do I fix this?

2 answers

✓ Accepted answer

Have you considered trying

Velocity.Velocity = (Handle.CFrame - Handle.CFrame.p) * Vector3.new(math.random(4, 16), 0, 0) + Vector3.new(0, math.random(4, 16), 0)

This should convert the x axis of the velocity to the object space of the handle

It didn't look too weird to me, maybe just tone down the velocity a little or make them different until you get a look you like.

This discussion is preserved as it was. New answers, comments, and votes are closed.