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

Help with blocks and body velocity?

game.Debris:AddItem(Bullet, 2)
        Bullet.Shape = "Ball"
        Bullet.Size = Vector3.new(2,0.1,0.1)
        Bullet.TopSurface = "Smooth"
        Bullet.BottomSurface = "Smooth"
        Bullet.Transparency = 0
        Bullet.BrickColor = BrickColor.new("Lime green")
        Bullet.CanCollide = false
        Bullet.CFrame = Gun.P4.CFrame
        Bullet.CFrame = CFrame.new(Bullet.Position,mouse.Hit.p)
        v = Instance.new("BodyVelocity", Bullet)
        v.velocity = Bullet.CFrame.lookVector *90
        v.maxForce = Vector3.new(math.huge, math.huge, math.huge)

This is part of my gun script, which uses BodyVelocity to have the bullet travel. The only problem is that it only work when it is a Ball shape. I need the bullet to be a Block shape for the 1 gun, but for whatever reason whenever I set the shape to Block it just freezes in mid-air. It's not anchored or anything. Help?

1 answer

✓ Accepted answer

i used this:

script.Parent.Equipped:connect(function(mouse)
	mouse.Button1Down:connect(function()
local Gun = script.Parent.Handle
local Bullet = Instance.new("Part")
        Bullet.Shape = "Block"
        Bullet.Size = Vector3.new(2,0.1,0.1)
        Bullet.TopSurface = "Smooth"
        Bullet.BottomSurface = "Smooth"
        Bullet.Transparency = 0
        Bullet.BrickColor = BrickColor.new("Lime green")
        Bullet.CanCollide = false
        Bullet.CFrame = Gun.CFrame
Bullet.Anchored = false
Bullet.Parent = game.Workspace
        Bullet.CFrame = CFrame.new(Bullet.Position,mouse.Hit.p)
        local v = Instance.new("BodyVelocity", Bullet)
v.Parent = Bullet
        v.velocity = Bullet.CFrame.lookVector *90
        v.maxForce = Vector3.new(math.huge, math.huge, math.huge)
game:GetService("Debris"):AddItem(Bullet,2)
	end)
	end)

and it worked fine. i don't know why your gun would make the parts in mid air, but this worked fine for me.

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