Is my script good? and how to make it a little bit better for the server?

i made this, tbh im a type of guy who just writtes scripts of what come to mine first and then i fix a little bit, and i was wondering if this is a good script?
is a module script for making a hitbox and adding what type of damage you would like, and before i chaged for more comfort while scripting and saw the strings availables.
my system is very spagetty like so im wanna be lazy to explain what and how you make the hitbox itself or the dmg type, but here the script

local dmgstype = require(script.Parent.HitBoxes)

local dmgscript = {}

function dmgscript.new(player, argument)
	local cratething = {}

	function cratething:FirstType(wich, ...)
		dmgstype.newhitbox(player, argument, wich, "FirstType", ...)
	end
	function cratething:SecondType(wich, ...)
		dmgstype.newhitbox(player, argument, wich, "SecondType", ...)
	end
	function cratething:ThirthType(wich, ...)
		dmgstype.newhitbox(player, argument, wich, "ThirthType", ...)
	end
	function cratething:Grab_Type1_Trigger(wich, ...)
		dmgstype.newhitbox(player, argument, wich, "Grab_Type1_Trigger", ...)
	end
	
	return cratething
end

function dmgscript:Call(plr: any, argument: string, something: string | "damage1" | "damage2" | "damage3" | "Grab_1_type", hitboxtype: string | "inbox" | "boundsinradius"  | "getinpart" | "line_raycasts" | "shapecast" | "spherecast", ...)
	if something == "damage1" then
		local newd = dmgscript.new(plr, argument)
		newd:FirstType(hitboxtype, ...)
	elseif something == "damage2" then
		local newd = dmgscript.new(plr, argument)
		newd:SecondType(hitboxtype, ...)
	elseif something == "damage3" then
		local newd = dmgscript.new(plr, argument)
		newd:ThirthType(hitboxtype, ...)
	elseif something == "Grab_1_type" then
		local newd = dmgscript.new(plr, argument)
		newd:Grab_Type1_Trigger(hitboxtype, ...)
	end
end

return dmgscript

(is on server)

something that i didnt mention, is that i used 2 BindableEvents for calling the hitbox stuff, thats why i wanted to put other function that is inside of the module scripts that basicly calls and conects the damage type and hitbox.

2 Likes