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

How can I fix my script so that Enemies explode on all sides of their target?

Asked by 4 years ago
Edited 4 years ago

Hello, I'm creating a game where Enemy NPC's try to get to the center of your base. When the NPC's do, they only explode on one side. How can I fix this?

Example: https://imgur.com/a/8CSH4r9

Code for Wall:

local Path = game:GetService("PathfindingService"):ComputeSmoothPathAsync(workspace.Start.Position,workspace.Wall.Position+ Vector3.new(3,0,0),500) -- PathFinding
local Positions = Path:GetPointCoordinates()

and

local Explode = Instance.new("Explosion",workspace) 
            Explode.Position = Enemy.HumanoidRootPart.Position
            Explode.BlastPressure = 0
            workspace.Wall.Health.Value = workspace.Wall.Health.Value - Enemy.Damage.Value
            Alive = false
            Enemy:Destroy() -- [B]

All help is appreciated.

**Full code: ** (Please excuse the excessive amount of comments near the end)

https://pastebin.com/gTUvznsS

0
I don't know why the bold is working... Phoenix_Ravin 19 — 4y
0
I recommend using .Touched on the wall qChaos 86 — 4y
0
@qChaos I inserted this script into the Wall itself, and, although it does explode, it doesn't explode at the right place. Code:        .function Explode(hit) Instance.new("Explosion",workspace) Explode.Position = workspace.Wall.Position end script.Parent.Touched:connect(Explode) Phoenix_Ravin 19 — 4y

Answer this question