Im trying to make a supply drop that falls from the sky but whenever I test the game the supply drop always just falls to the ground immediately the supply drop is not anchored it is only welded.
Here is the script I used
1 | local SupplyDrop = game.Workspace.SupplyDrop |
2 |
3 | while true do |
4 | if SupplyDrop.Box.Position.Y > 6 then |
5 | SupplyDrop.Box.Position.Y = SupplyDrop.Box.Position.Y - 5 |
6 | end |
7 | wait( 2 ) |
8 | end |
I do this in my game using BodyForce and BodyVelocity:
01 | local speed = 20 --Change this to change how fast you want the box to fall |
02 |
03 | local SupplyDrop = game.Workspace.SupplyDrop |
04 | local box = SupplyDrop.Box |
05 |
06 | local BodyForce = Instance.new( "BodyForce" ,box) |
07 | BodyForce.Force = Vector 3. new( 0 ,box:GetMass()*game.Workspace.Gravity, 0 ) --Make a force to counteract gravity |
08 |
09 | local BodyVelocity = Instance.new( "BodyVelocity" ,box) |
10 | BodyVelocity.Velocity = Vector 3. new( 0 ,-speed, 0 ) --Make the box fall at a constant velocity |
The BodyForce makes the box weightless by pushing the box up at the same strength Gravity pulls it down.
The BodyVelocity then pushes it down at a constant velocity.
EDIT: Clarification