wait(5)
for i = 1,40,1 do
Meteor = Instance.new("Part")
Meteor.Size = Vector3.new (3,3,3)
Meteor.Material = "Neon"
Meteor.Color = Color3.new (180, 110, 255)
Meteor.CFrame = script.Parent.UpperTorso.CFrame
Meteor.CanCollide = false
Meteor.Parent = game.Workspace
local mesh = Instance.new("SpecialMesh")
mesh.MeshType =("Sphere")
mesh.Parent = Meteor
local bv = Instance.new ("BodyVelocity")
bv.Parent = Meteor
bv.Velocity = Vector3.new(math.random(-60,60),math.random(-60,60),math.random(-60,60))
game:GetService("Debris"):AddItem(Meteor, 5)
local ten = true
script.Parent.UpperTorso.LSSJBarrier.BARRIER.Enabled = true
script.Parent.Humanoid.WalkSpeed = 0
local char = script.Parent --the npc
local hum = char:WaitForChild("Humanoid") --the npc's humanoid
local animation = hum:LoadAnimation(script.Animation)
local HP = script.Parent.Humanoid.WalkSpeed
animation:Play()
wait(.1)
animation:Stop()
script.Parent.Humanoid.WalkSpeed = 8
script.Parent.UpperTorso.LSSJBarrier.BARRIER.Enabled = false
Meteor.Touched:connect(function(hit)
local HitAble = false
if hit:IsDescendantOf(script.Parent) then return end
if not HitAble then return end
local root = hit.Parent:FindFirstChild("HumanoidRootPart")
if root and not root.Anchored then
local myRoot = script.Parent:FindFirstChild("HumanoidRootPart")
if myRoot then
local delta = root.Position - myRoot.Position
if not ten then return end
ten = false
local human = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
if human ~= nil then
local bv = Instance.new("BodyVelocity")
bv.maxForce = Vector3.new(1e990, 1e990, 1e990)
bv.velocity = delta.unit * 180
bv.Parent = root
game:GetService("Debris"):AddItem(bv, 2.25)
elseif hit.Anchored == true and hit.CanCollide == true then
Meteor:Destroy()
end
end
end
end)
end
the script works perfectly but the bodyvelocity part isn't giving the character bodyvelocity. unless the velocity is very weak i dont see why it isnt working

1 comment
http://robloxdev.com/articles/Writing-Clean-Code