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

Need help with BodyVelocity? S O S!

Asked by 8 years ago
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
run = game:GetService('RunService')
Character = Player.Character
enabled = false
function sword(ky)
    if ky == "q" then
        enabled1 = true

        Part = Instance.new("Part", Character)
        Part.FormFactor = "Custom"
        Part.Size = Vector3.new(1.05, 5.48, 1.15)
        Part.CanCollide = false
        Part.BrickColor = BrickColor.new("Black")
        Weld = Instance.new("Weld", Character)
        Weld.Part0 = Weld.Parent["Right Arm"]
        Weld.C0 = CFrame.Angles(0, 0, 0)
        Weld.Part1 = Part
        Weld.C1 = CFrame.Angles(0, 0, 0) *CFrame.new(0, -1, 1)

    end
end


function onkey(key)
    key = key:lower()
    if key == "r" and enabled1 == true then


        LOL = Instance.new("Part",workspace)
        LOL.Size = Vector3.new(3, 3, 3)
        LOL.BrickColor = BrickColor.new("Black")
        LOL.Shape = "Ball"
        LOL.CanCollide = false
        LOL.Transparency = 0.5
        LOL.Name = Player.Name
        LOL.CFrame = Character.Torso.CFrame*CFrame.new(1, 2, -5)
        Fire = Instance.new("Fire",LOL)
        Fire.Heat = 12
        Fire.Size = 15
        game.Debris:AddItem(LOL, 5)
        Power = Instance.new("BodyVelocity",LOL)
        Power.Velocity = Character.Torso.CFrame.lookVector*80
        Power.maxForce = Vector3.new(math.huge, math.huge, math.huge)
        run.Stepped:wait()
        for i = 1, 10 do
        RS = Character.Torso["Right Shoulder"]
        RS.C0 = RS.C0 *CFrame.fromEulerAnglesXYZ(0, 0, 0.20)
        run.Stepped:wait()
        end
        for i = 1, 10 do
        RS = Character.Torso["Right Shoulder"]
        RS.C0 = RS.C0 *CFrame.fromEulerAnglesXYZ(0, 0, -0.20)
        run.Stepped:wait()
        end
    end

end
Mouse.KeyDown:connect(sword)
Mouse.KeyDown:connect(onkey)

Equips the bazooka when q is pressed, shoots when r is pressed. The first shots works, but when I move around, it stops working and the bullets spawns infront of me... Just test and see and u will understand what I mean..

Ty in advance!

Answer this question