Restrictly is an Open Source Ban system for anyone! At the time of posting, it has 7 commands for people to use! It was designed to be easily implemented into things such as Admin Panels, or just be used by itself!
How to get Restrictly
You can get the ModuleScript for Restrictly here.
Alternatively, you can use this code in Roblox Studio:
require(6530046094)
And if all else fails, use this:
local Module = game.InsertService:LoadAsset(6530046094)
Module.Parent = game.ServerScriptService -- or whatever
Current Commands
There are currently 8 commands.
Restrictly.Restrictly()
Parameters: None Function: Prints Information such as current module version, current Lua version, rights, etc.
Restrictly.Ban(Player, Reason)
Parameters: Player to ban's name, Reason for ban Function: Bans a player for the given reason until unbanned. Reason becomes "Unspecified Reason" if left blank.
Restrictly.IdBan(UserId, Reason)
Parameters: UserId to ban, Reason for ban
Function: Works like Restrictly.Ban(), but uses Player.UserId
Restrictly.Unban(Player)
Parameters: Player to unban's name Function: Unbans a Player.
Restrictly.ServerBan(Player, Reason)
Parameters: Player to ban's name, Reason Function: Works similar to Restrictly.Ban(), however only bans for the Server.
Restrictly.ServerUnban(Player)
Parameters: Player to Unban's name Function: Reverses a Server Ban
Restrictly.Restrict(Player)
Parameters: Player to affect's name Function: Sets a Player's WalkSpeed and JumpPower to 0.012. Makes their screen black, with everything barely visible.
Restrictly.Unrestrict(Player)
Parameters: Player to affect's name Function: Reverses a Restrict Ban Note: For these functions (Restrict and Unrestrict) to work, there has to be a ScreenGui named "DarkGui" and a Frame named "DarkFrame" in the DarkGui
Thank you for reading!
If you use this module, please don't claim that you created it! Crediting me is not necessary, however would be greatly appreciated!
Leave your creations down in the comments!
If you have any concerns or suggestions, please leave them in the comments!
I read your source code, it would be better to put the reason as the value rather than a bool, and there would be a problem if multiple requires are called on the module script, as there will be more game.Players.PlayerAdded events
EDIT: Roblox caches the result the module script returns and returns that value on future requires to that module script. So the module script will only be ran once. My mistake.
I see some potential flaws in this module, such as here (I’ve pointed them out):
game.Players.PlayerAdded:Connect(function(Player)
if Bans:GetAsync(Player.UserId.."-banned") == true then -- unprotected async call
print("Player is banned! - "..Player.Name)
if ReasonData:GetAsync(Player.UserId.."-reason") == "" or ReasonData:GetAsync(Player.UserId.."-reason") == nil then -- two more
ReasonData:SetAsync(Player.UserId.."-reason", "Unspecified Reason") end -- another
Player:Kick("You have been banned from this game: "..ReasonData:GetAsync(Player.UserId.."-reason")) -- another
elseif table.find(serverBanned, Player.UserId) then
Player:Kick("You have been banned from this game: "..GlobalReason)
else
print(Player.Name.." - is not banned!")
end
end)
Putting these problems aside, why use this module instead of mine:
or my main competitor’s:
in which both are arguably better as far as services go?
That’s not how multiple require calls work on module scripts.
If the module has been required already, it returns the reference to the table that was returned the first time. Otherwise Class modules and other OOP code would be useless.
Because none of these three are admin systems? Some developers don’t like admin systems, or prefer to make their own. They do provide usefulness if you don’t want to/don’t know how to make ban systems.
My point still stands, just because developers don’t like to make their own systems, doesn’t mean that your module is useful, it at least needs to provide an utility that developers that are using it may find useful, many of the functions that your module provides are almost guaranteed to be available in every admin system and anyone can implement those in under 10-15 minutes.
@OP: By looking at the source, this module is definitely not reliable and contains many bad practices.
You aren’t handling any errors that GetAsync and SetAsync throw, since they are asynchronous functions.
These types of error handling is not successful, since all you’re doing is just pcalling them and printing out errors, not even retrying if they fail:
Your module also relies on GetUserIdFromNameAsync to never error, which is also a huge flaw, since it is also an asynchronous function and is prone to errors. Another flaw is how this module uses SetAsync very frequently, even though it is for different keys, it still isn’t a good solution.
Most of the functions that this module provides are found in every admin system, the only difference is that this one isn’t reliable, I wouldn’t consider this module.