FragmentSmasher - Window/other object obliterator Module

Hello everyone! I noticed that there are posts about the destruction of windows, but no open sourced code or modules I could find on the subject. So, I created FragmentSmasher, a simple module with one function for the destruction of windows and other things.

The module contains one useful function,BreakSurface(), for breaking apart a square/rectangular shaped part. It works by taking the original part, and replacing it with a multitude of triangles of the same total size.


FragmentSmasher= require(game.ServerStorage.FragmentSmasher)


	-Pane- the Part you want to effect
	-BreakOriginPositionVector- the center of destruction, and the middle point of the calculations
	-DirectionalVelocityVector- a direction Vector3 that determines the general direction for the fragments to fly toward(Pass the string "Default" to use the Default vector)
	-SoundId- the SoundId to be played on smash(Pass the string "None" to use no Sound)
	-DestroyTime- the amount of time that passes before the fragments are deleted from the workspace(Pass the string "Never" for the fragments to exist for a infinite amount of time)
Basic Usage:


FragmentSmasher= require(game.ServerStorage.FragmentSmasher)


This code is a basic example of how to break a window, or other object.


Gun Example:

Example Code:

FragmentSmasher = require(game.ServerStorage.FragmentSmasher)

local Gun = "gun"
MouseHit = "mouse hit position"
function OnShoot()
    local ray =, (MouseHit - Gun.Barrel.Position).unit * 300)

    local part, position = workspace:FindPartOnRayWithIgnoreList(ray, {Gun})

    if part.Name == "Window" then
            Gun.Barrel.CFrame.LookVector * 75 +, 25, 0),

This basic example creates a Ray, which it then uses to find the position the Ray hit, and the part the Ray hit. If the part is named “Window”,it fires the module’s BreakSurface() function with a BreakOriginPositionVector of the Ray hit position, and a DirectionalVelocityVector that faces away from the shotgun. This results in something similar to the following I created.


Fun, right?

Keep in mind that the long sides of your window must be the X and Y axis, otherwise the calculations will not work properly.

Link to obtain:

Enjoy! :grinning:


Cool module

There’s an error though
You should probably fix this

I think you meant to write “FragmentSmasher” instead of “FaceSmasher”
It works fine once you change that


Thank you so much for pointing this out! I fixed before I released the module, but must have forgotten to publish the fix. Thanks again.

Problem Resolved

1 Like

Is it possible able to cut like a lightsaber on the metal or door?

This module is more for completely destroying a part, not really making precise cuts.

However you could probably make a system similar to mine, that works by dividing a single part into many smaller parts. You would just have to use more parts the more detail you want. I created the module to be very understandable, so you should be able to modify it to help you in that way.

DM me if you have further questions, or would like some more guidance, and I would be happy to help out to the best of my ability!

1 Like

Ah okay but did it use unions or just only parts? If it parts hopefully I’ll try see what I can do with it but for union it hard since it have limited

It uses just parts. It works by taking the original dimensions of the part, and subdividing it into smaller parts inside of it. It you used it on a union it would just make rectangular sections with similar dimensions to the union, but not take on the unions shape. Making it work with unions would be much harder, because union calculations take a excruciatingly long time to process, and the delay would be very long.


Ah okay thank you for answer it.

Really epic module with an even epicer concept!
Nice contribution! :smile:

1 Like

I’ve tried shooting at a part with this module but nothing happens. The part doesn’t divide and break when I shoot at it.

This is most likely due to a misuse of the module. Can you send me your current code in DMs, so I can try to help you figure it out?