FlareTool [New Tool Framework]

FlareTool

Hey developers.

I’m quite excited to bring out a new Tool Framework for Roblox, when I first started making this it was going to be used privately but I honestly believe that developers across the platform can benefit from this in some way.

I personally dislike having many scripts and remote events per tool (if the tool needs networking), so I created a framework similar to the way Knit works to handle it all for you. I’ve taken a lot of inspiration from Knit and some other frameworks on the platform to make this really cool module.

I understand this isn’t going to be everyones cup of tea :tea: but I hope this does help some people and they can start to use it in their games.

Please be warned this has not been battle tested so bugs could occur, if they do I encourage you to report them to me so I can roll out fixes for them.

Now that’s the boring stuff out the way, lets drill down into the framework…

Installation & Setup

Drag the FlareTool module into ReplicatedStorage (wherever this module is placed it needs to be accessible via server and client).

Put a script in ServerScriptService with this contents.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local FlareTool = require(ReplicatedStorage.FlareTool)
FlareTool:RegisterTools(script.Tools)

image

Once that’s in, you can start filling the Tools folder with tools you want to integrate into the framework.
The tool modules must be formatted like this.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Builder = require(ReplicatedStorage.FlareTool.Misc.Builder)

local TestTool = Builder.CreateTool {
	Name = "TestTool",
	Client = {},
}

function TestTool.Loaded() 	
    print("The tool is loaded")
end

return TestTool

An example of a Module with signal creation and remote routing:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Builder = require(ReplicatedStorage.FlareTool.Misc.Builder)

local TestTool = Builder.CreateTool {
	Name = "TestTool",
	Client = {},
}

function TestTool.Client:TestFunction(Player: Player)
	print("Wow! This executed on the server..")
end

function TestTool.Loaded() 	
	TestTool:CreateSignal("TestSignal")
	
	TestTool:CreateProperty("TestProperty", {
		Test1 = 5,
		Test2 = "HIIIII"
	})

	TestTool:PushCallback("Activated", "Function1", function()
		local Owner = TestTool:GetRootOwner()
		
		TestTool.Client.TestSignal:Fire(Owner)
		TestTool.Client.TestProperty:SetFor(Owner, {})
	end)
end

return TestTool

Now we’ve set up the framework, we need to load the framework into the tool instance.

image

Server:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Builder = require(ReplicatedStorage.FlareTool)
local Class = Builder:Build(script.Parent)

~ This builds the tool instance on the server and all of the remote routing.

Client:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Builder = require(ReplicatedStorage.FlareTool)
local Class = Builder:GetBuild(script.Parent)

~ This loads in the server build (remote routing for the client).

And that’s the setup complete!

The Module you placed under the “Tools” folder is what controls the instance on the server, this is where you will write all of the code and enable the tool events (activated, equipped, unequipped).

We use Sleitnicks modules for the backend of the framework (mainly Comm. The Builder has :CreateSignal() and :CreateProperty() integrated into it for ease of access.

Whatever function you put in the .Client table inside of the tool module will open a comm for the client to communicate with meaning that code will function as if it was fired from a remote event.

I understand it’s going to be difficult to grasp this entirely so I have provided a place link below that contains all of the necessary information and a template setup for you to use!

FlareTool will handle all networking for you and is designed for ease of access.

(I am pretty bad at documentation so reach out if you have any questions)

9 Likes

I’m new to coding so what exactly does this do? It kinda hard to figure out from the topic.

1 Like