Gibs and destruction module
by mothstocker
you can get the module here.
gibs and destruction is a module script that makes tasks like making gibs or craters easier to use and easy to reuse.
GAD can be used in local and server scripts.
GAD has support for fully user created gibs. (that means users can upload their own gibs to the toolbox for other users to use, even you can create your own!)
GAD is super simple and easy to use, and creating your own gibs only requires basic scripting knowledge.
and if you need any help with scripting a gib, i can happily help and provide!
how to use Gibs and Destruction
first, require GAD from replicated storage.
local gad = require(game.ReplicatedStorage.gad) -- Requires the script lol
once thats done, create a new caster.
local gad = require(game.ReplicatedStorage.gad) -- Requires the script lol
local caster = gad.new() -- Creates a new caster.
now to create a gib cast!
local gad = require(game.ReplicatedStorage.gad) -- Requires the script lol
local caster = gad.new() -- Creates a new caster.
wait(8) -- here so you can find and see it work.
local cast: UnionOperation = caster.cast("explosion", script.Parent.Position, script.Parent.Rotation) -- cast: UnionOperation is optional, sometimes it wont show the propertys of the returned cast.
and it should look like this!
now, you might be asking “how do i use caster.cast?”
well, it is very simple.
the two most important things in GAD is GAD itself, and the gibs folder.
the gibs folder hold every gib.
if you want to cast a gib, you need to first get the gibs name.
say i want to cast the gib “explosion”, all i need to do is get the the gibs name “crater”, then i fire a caster.cast function with the gibs name, desired position and desired rotation as the context, like this.
local cast: UnionOperation = caster.cast("explosion", script.Parent.Position, script.Parent.Rotation)
and then your done!
but now…
GAD has support for fully user created gibs.
your asking how do i create my own gibs?
it is also very simple.
you want to first duplicate the TemplateGib,
then change the name of the duplicate to your desired name, and make sure it does not have the same name as other gibs
it should look like this.
then open it!
the inside of TemplateGib should look like this.
local module = {}
--[[
the function that the caster will call when this gib is casted.
make sure there are no duplicate names.
]]
function module.gib(position, rotation)
local template = require(script.Parent.Parent.utilitys).SpawnParts(4, position)
template.Parent = workspace
return template
end
return module
everything that happens when you cast a gib, is inside the module.gib function, remove all the code in the function then script away! the script is your oyster!
and thats really it!
as i said, if you need ANY help, just tell me and i will help as soon as i can, also if theres anything that could possibly make this any better, or you have a suggestion, just tell me (again), and if there was anything i was not clear about or something you cant understand, tell me (again lol)
there is also alot of things i still want to add and this is nowhere near done.
buh bye!