Im not a great programmer but have been really into learning how to script in Roblox lately and this site has helped me learn alot over the past few months.
I am trying to Script a wall that blows up when it is touched by a FireBall. So I made the FireBall launcher tool (which shoots spheres named fireballs)
and then I created a wall named DestructibleWall I then attached a script to the DestructibleWall and wrote the following code.
local function OnTouched(hit)
if hit.Name == 'FireBall'
then
Instance.new("Explosion", game.Workspace)
local explosion = Instance.new('Explosion')
game.Workspace.Explosion.Position = script.Parent.Position
script.Parent:Destroy()
end
end
script.Parent.Touched:connect(OnTouched)
Sadly this is not working. Nothing Happens when the FireBalls touch the wall. I should mention that the FireBalls create Explosions when they touch any object. I'm not sure what I'm doing wrong here. Any advice would be very much appreciated.

6 comments
wait, why did you put Instance.new("bla bla bla", parent) without a reference, and later you writed the same thing without a parent?
Because I would also like to create explosion when the wall is hit though (2 explosions, probably unnecessary). Looks like I failed to make that clear.
and can you tell to me what error print your output?
More interested in just being able to destroy the wall when the fireball touches it.
you should connect the touched event to the fireball instead
I'm not outputting any errors it seems. I should add that the FireBall is a cloned object if that helps.