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

BodyVelocity not moving the object?

Asked by 8 years ago

Hi, I created a fireball that moves with BodyVelocity, it works when I stand still and use it but when I move and use it, the fireball doesn't move.

local player = game.Players.LocalPlayer
local inputservice = game:GetService('UserInputService')

function leftpunch(input)
    if input.KeyCode == Enum.KeyCode.Q then
        local lpanim = player.Character.Humanoid:LoadAnimation(script.leftp)
        lpanim:Play()
        wait(.4)
   local leftfire = Instance.new('Part',game.Workspace)
leftfire.Transparency = 0
leftfire.Shape = 'Ball'
leftfire.Size = Vector3.new(5,5,5)
leftfire.CFrame = player.Character['Left Arm'].CFrame*CFrame.new(0,0,3)
leftfire.Material = 'Neon'
leftfire.CanCollide = false
leftfire.BrickColor = BrickColor.new('Really red')
local fire = Instance.new('Fire',leftfire)
local velo = Instance.new('BodyVelocity')
velo.maxForce = Vector3.new(math.huge, math.huge, math.huge)
velo.Velocity = player.Character.Head.CFrame.lookVector*50
velo.Parent = leftfire
repeat 
    wait(0.01)
    leftfire.Transparency = leftfire.Transparency+0.06
until leftfire.Transparency >= 1
leftfire:remove()
lpanim:Stop()
    end
end
inputservice.InputBegan:connect(leftpunch)  
0
You have not set "P" User#5423 17 — 8y

Answer this question