Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My Bullet Floats Straight Up?

Asked by 10 years ago

My Bullets just float straight up into the sky when I shoot

plr = game.Players.LocalPlayer
enabled = true
waittime = 0.1
button = script.Parent

function Fire()
    if enabled then
        enabled = false
        p = Instance.new("Part",workspace)
        p.Name = "Bullet"
        p.BrickColor = plr.TeamColor
        p.CanCollide = false
        p.TopSurface = "Smooth"
        p.BottomSurface = "Smooth"
        p.FormFactor = "Custom"
        p.Size = Vector3.new(0.2,0.2,6)
        mouse = plr:GetMouse()
        pos = script.Parent.Handle.Position
        focus = mouse.Hit.p
        p.CFrame = CFrame.new(pos,focus)
        p.CFrame = p.CFrame+p.CFrame.lookVector*5
        v = Instance.new("BodyVelocity",p)
        v.maxForce = p.CFrame.new(4000,4000,4000)
        v.Velocity = p.CFrame.lookVector*250
        wait(waittime)
        enabled = true
    end
end

script.Parent.Activated:connect(function()
    Fire()
end)
0
My Bullets just float straight up into the sky when I shoot ILikepie2100 20 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

I'm not good with these type of things, but I think it's something to do with your BodyVelocity. It's probably set up wrong, so instead of the bullets going straight, they go up.

Ad

Answer this question