The plugin seems like an overkill. The framework is one object that you put into replicated storage and it’s done! No need to hog your plugin space with something that inserts one object. If it required multiple objects in multiple services or places I’d consider because it may be harder to setup. I update the model regularly so worry not. If you start a new project it’ll most likely be updated.
I do want to re-iterate something since I am replying; I’m currently using this framework for game production as a experiment. This experiment will help me figure out what features are useful, what features need to be removed and what features do I need to improve the framework.
I also want to mention that when I was constructing this framework, the ideal goal was to be able to stick on the server as much as possible. As I’ve tested the framework I’ve noticed one issue that may or may not be problematic.
- GetService, GetDatabase, GetClass
I’ve noticed that creating services, databases and classes at run time can be fairly problematic. The reason for it being problematic is because within your class or service you may want to have reference to another class or service and utilize that. The first solution to this issue is to do GetService, GetDatabase and GetClass within the function like so:
local ControlsHandler = Rex:CreateClass("ControlsHandler", {}, {
Sprint = function(Player)
local StatesDatabase = Rex:GetDatabase("States") -- You'll notice I did it in here
local Character = Player.Character
local Humanoid = Character and Character.PrimaryPart and Character:FindFirstChild"Humanoid"
if Humanoid then
StatesDatabase[Player.Name].Sprinting = not StatesDatabase[Player.Name].Sprinting
Humanoid.WalkSpeed = (StatesDatabase[Player.Name].Sprinting and 24 or 16)
Rex:ReplicateDatabase()
end
end,
})
Now this can get really annoying having to do that within every function. GetService, GetDatabase and GetClass are methods that will yield until Rex:Start() is called.
The other solution is the use of metatables. If I were to require a module and it had Rex:GetService() at the top, it’ll yield and result in a infinite yield. The solution is to not require all the modules and cache them at once, rather cache them and require them when you need them. Chances are the functions won’t be called at runtime.
local StandAbilities = {}
for _, Stand in ipairs(ServerStorage["Stand Abilties"]:GetChildren()) do
StandAbilities[Stand.Name] = {}
setmetatable(StandAbilities[Stand.Name], {
__index = function(ot, index)
ot[index] = require(Stand[index])
return ot[index]
end
})
end
These issues I’ve considered as minor for the time being. If I can come up with a solution to make it even easier I will do so. At the moment, I’m looking at prebuilt services to help people stick on the server. I’m considering: SoundService
, and ParticleService
(you’ll notice most of these are special effects related that should be done on the client which is why I did AnimateService).
EDIT: There was an issue previously with :GetService
, :GetClass
, :GetDatabase
. Where it would yield even though it already existed (was prebuilt). I’ve fixed this in a newer version of the Rex framework allowing you to call those functions before Rex:Start().