Method to Implement Melee Frameworks?

Hello everyone! I want to create a melee framework for my weapons; so I don’t need to manually edit each script when I want to change how it functions. However, I’m uncertain how to implement Module Scripts without creating errors, as I am currently unfamiliar with them.

I’ve tried using the ‘require’ function on a local script however, the result was the script being unable to find the assets for materials such as the tool’s parent, being the player. This was how I required it:

-- this script is located inside of the tool

local Framework = require(game.ServerScriptService.MeleeFramework)

Framework({
	Player = script:FindFirstAncestorWhichIsA"Player" or game:GetService"Players":GetPlayerFromCharacter(script.Parent.Parent),
	Tool = script.Parent, 
})

Here’s the output I received:

RobloxStudioBeta_0JsWcP1Ala

Getting this problem solved would help benefit development greatly. I can provide more photos of how this script works if necessary, too. :smile:

You need an init function to set the variables. Framework.init would be suitable in your case.

Can you show the module?‏‏‎‏‏‏‎ ‎

Interesting. Is there any documentation or procedure on how I could use this function?

Nope. It’s something you need to make yourself. It simply will set the variables in the module and maybe also start the framework for a specified tool.

For example, you might do Framework.init(Tool).