I have a script for a long-range attack and I want to make it create an explosion anytime it collides with ANYTHING because right now, it only explodes when players are directly hit, and just phases through everything else.
I’ve searched far and wide and couldn’t seem to find anything that would help me do this, I’ve only seen people explain how to create explosions when collisions between specific parts occur, but that’d be pretty difficult to do seeing as my map has like 5k of them. Thank you
Here’s the current code i’m using:
if Switch.Value == false then
Ki.Parent = Cac.Humanoid
Ki.CFrame = Cac.HumanoidRootPart.CFrame
Ki.Position = RHand.Position
Switch.Value = true
Cac.Humanoid:LoadAnimation(script.Parent.Parent.Animation):Play()
local sound = script["Ki blast"]:Clone()
sound.Parent = Ki
sound:Play()
sound.Script.Disabled = false
local Part = Ki
game.Debris:AddItem(Part, 6)
local HRP = Player.Character:WaitForChild("HumanoidRootPart")
local PPosition = RHand.Position + CFrame.new(RHand.Position,Mouse.p).lookVector * 1
Part.CFrame = CFrame.new(PPosition, Mouse.p)
Part:SetNetworkOwner(Player)
local BV = Instance.new("BodyVelocity" , Part)
BV.Velocity = HRP.CFrame.LookVector * 140
BV.MaxForce = Vector3.new(1e8,1e8,1e8)
wait(4)
Part:destroy()
return
end