So I am making a lightning ball ability which will hurl a lightning ball and when it is touched, it does this cool little explosion hit box and anyone getting hit by it will get hurt, and I get the mouse and stuff and then I create a body velocity so then I hurl the lightning ball at the mouse’s position. all of the things are working perfectly fine, its just its not moving, it just falls down, this is the script that does the hurl part.
game.ReplicatedStorage.Fire.OnClientEvent:Connect(function(plr, mouseHit, tool)
local rocket = game.ReplicatedStorage.Assets.LightningBall:Clone()
rocket.Parent = workspace
rocket.CFrame = CFrame.new(tool.Tip.Position, mouseHit)
local bv = Instance.new("BodyVelocity", rocket)-- this is the body velocity part
bv.Velocity = CFrame.new(rocket.Position, mouseHit).LookVector * 100 -- this is the body velocity part
rocket.Touched:Connect(function(hit)
if hit:IsA("BasePart") then
if hit.Parent ~= tool then
rocket:Destroy()
game.ReplicatedStorage.Fire:FireServer(rocket.Position, mouseHit)
end
end
end)
end)
can you guys help me and tell me why my lightning ball is not moving?
Add
bv.MaxForce = vector3.new(math.huge,math.huge,math.huge)
I got one more question.
in this other script when there is a explosion effect, if the part is touched, then it will do 15 damage to them, but when I test it, it just instantly destroys it, I know that it is touching multiple times, so I add a debounce for damaging, but it still won’t work, can you help me?
game.ReplicatedStorage.Fire.OnServerEvent:Connect(function(plr, rocketPos, mouseHit, part)
local explosionPart = Instance.new("Part", workspace)
explosionPart.Anchored = true
explosionPart.CanCollide = false
explosionPart.Size = Vector3.new(8.898, 8.898, 8.898)
explosionPart.BrickColor = BrickColor.new("Cyan")
explosionPart.Transparency = 0.7
explosionPart.Shape = "Ball"
explosionPart.Position = rocketPos
local expoSound = game.ReplicatedStorage.LightningExplosionSound:Clone()
expoSound.Parent = explosionPart
expoSound:Play()
explosionPart.Touched:Connect(function(part)
local Humanoid = part.Parent:FindFirstChild("Humanoid")
local canDamage = true
if Humanoid and canDamage == true then
canDamage = false
Humanoid.Health = Humanoid.Health - 15
wait(1)
canDamage = true
end
end)
wait(3)
explosionPart:Destroy()
end)