local brick = game.Workspace --the part that u wnt to have explode when touched
brick.Touched:connect(function(hit)
if hit.Parent and hit.Parent.Humanoid then
humanoid = hit.Parent.Humanoid
explode = Instance.new("Explosion", brick)
end)
✓ ANSWER ACCEPTED
ontouch or touch invalid?
1 answer
✓ Accepted answer
function ont (hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local e = Instance.new("Explosion")
e.Parent = script.Parent
e.Position = script.Parent.Position
end
end
script.Parent.Touched:connect(ont)
There you go, that should work!
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Reason for error: Your local brick is the whole workspace, if you wanted to do the whole workspace then you would need to do game.Workspace:GetChildren() <-- using that to replace the bricj - game.Workspace you also need a position for the explosion.
Thanks!!
You should also keep the
hit.Parentcheck!