Help with scripting rock debris

Hello, I am trying to make an effect where rocks spread and fly out sort of like this: https://gyazo.com/41de79feee18db47bcdfe9587a66d864 , but this keeps happening when I try to attempt doing it: Watch bandicam 2019-06-29 13-55-26-845 | Streamable (skip to 0:10) Here’s my code:

for i = 1, 5 do 
    local Part = Instance.new("Part")
	Part.Anchored = false
    Part.Name = "Part"
    Part.Shape = "Block"
    Part.Anchored = false
    Part.Size = Vector3.new(2.5,2.5,2.5)
    Part.Material = Enum.Material.Concrete
    Part.CanCollide = false
    Part.CFrame = ochar.UpperTorso.CFrame
    Part.BrickColor = BrickColor.new("Brown")
    local bv = Instance.new("BodyVelocity")
    bv.MaxForce = Vector3.new(50000,50000,50000)
	Part.Velocity = Part.CFrame.LookVector * 90 + Vector3.new(0, 90, 0)
	Part.CFrame = Part.CFrame * CFrame.Angles(math.rad(math.random(30, 50)), math.rad(math.random(30, 50)), math.rad(math.random(30, 50)))
    bv.Parent = Part
    Part.Parent = workspace
	wait()
end

Help would be appreciated!

4 Likes

From what I remember, a BodyVelocity will make the part not affected by gravity, if you still want it to be affected by gravity you should probably set the Velocity of the part directly.

 local Part = Instance.new("Part")
	Part.Anchored = false
    Part.Name = "Part"
    Part.Shape = "Block"
    Part.Anchored = false
    Part.Size = Vector3.new(2.5,2.5,2.5)
    Part.Material = Enum.Material.Concrete
    Part.CanCollide = false
    Part.CFrame = ochar.UpperTorso.CFrame
    Part.BrickColor = BrickColor.new("Brown")
    local bv = Instance.new("BodyVelocity")
    bv.MaxForce = Vector3.new(100)
	Part.Velocity = Part.CFrame.LookVector * 90 + Vector3.new(0, 90, 0)
	Part.CFrame = Part.CFrame * CFrame.Angles(math.rad(math.random(30, 50)), math.rad(math.random(30, 50)), math.rad(math.random(30, 50)))
    bv.Parent = Part
    Part.Parent = workspace
	wait()
end

I think you must change the MaxForce of the rock. Put it 100

The probable solution lies in gravity or BodyForce. BodyForce with negative Y will force it down like gravity do, it is accelerating down.

Remember to set initial velocity of the part, not through BodyVelocity(or else it’ll float), but through changing BasePart.Velocity. Rest goes to physics.


@CNales13 Vector3.new(100) results in Vector.new(100, 0, 0). This does not solve the problem. Unless you meant Vector3.new(100, 100, 100).

2 Likes