Velocity based projectiles?

When I keep it as the original it errors

  00:57:17.125 - Workspace.Script:33: bad argument #2 to '?' (Vector3 expected, got number)
00:57:17.127 - Stack Begin
00:57:17.127 - Script 'Workspace.Script', Line 33 - global FireArrow
00:57:17.128 - Script 'Workspace.Script', Line 51
00:57:17.128 - Stack End
1 Like

Oh, I assumed gravityForce was a vector and not a number. In that case replace that one line with these:

local adjustedDir = dir + Vector3.new(0, dt * gravityForce * GRAV_FORCE_MULTIPLIER, 0)
cframe = CFrame.new(newPos, newPos + adjustedDir)
1 Like

That works!
Thank you so much for helping me out here, I would never have figured that out.

1 Like

Hi! It’s great to finally be a part of the forum. Yes, for the most part you’ll want to do projectiles client-side or there will be a noticeable jump as you wait for the server to create the projectile.

In Snowman Simulator, I create the snowball locally and fire the server, the server then loops through all other connected clients and fires another event for each one to create a snowball with the same parameters.

For the Snowball I just use an unanchored part with the Touched event, give it directional velocity, and use a BodyForce to give it more lift. Don’t have as much control as buildthomas’ solution, but it seems to be pretty accurate :slight_smile:

2 Likes

Thanks for the reply :smile:

Successfully Implemented it to the game with replication!
https://www.roblox.com/games/534701013/The-Labyrinth

2 Likes