How would i make a script when the player clicks a brick and the brick blows up and hurts the player? BOOM!
local part = script.Parent local debounce = false function boom(pos, pressure, radius, explosionType) local explosion = Instance.new("Explosion", game.Workspace) explosion.Position = pos explosion.BlastPressure = pressure explosion.BlastRadius = radius explosion.ExplosionType = explosionType or explosion.ExplosionType end part.ClickDetector.MouseClick:connect(function(player) if not debounce then debounce = true boom(part.Position, 250, 250) wait(2) debounce = false end end)
First of all, you need to make a ClickDetector inside of the brick. Put a script into that ClickDetector.
Put this in the script:
local Detect = script.Parent local function onMouseClick() local Brick = CD.Parent local e = Instance.new("Explosion") e.Position = Brick.Position e.BlastPressure = 10000 e.BlastRadius = 10 --Change this to the ClickDetector radius for best experience. e.ExplosionType = 0 --Does no terrain damage e.Parent = Brick end Detect.MouseClick:connect(onMouseClick)
Hope this helps ya!