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

Explosion.Hit not correctly working?

Asked by 3 years ago

Explosion.Hit doesnt exactly work correctly for whatever reason. this is the first time i've had this problem. When the part explodes and hits all the parts around it; it only prints one part.. instead of all the parts it hit. and also doesn't change the brick color. Any help please? Would be greatly appreciated!

script.Parent.Touched:Connect(function()

    local explo = Instance.new("Explosion")
    explo.Parent = game.Workspace
    explo.BlastRadius = 5
    explo.Position = script.Parent.Position
    explo.Hit:Connect(function(partHit)
        print(partHit)
        if partHit.Name == "Part" then

            game.Workspace.PARTsHit.Value = game.Workspace.PARTsHit.Value + math.random(4,12)
            partHit.BrickColor = BrickColor.new("Black")
            script.Parent:Destroy()
            else

    wait(0.01)
            script.Parent:Destroy()



    end
    end)
    end)

Answer this question