I added an extra security method that was inspired by the CG gun kit or whatever its called that is used by prison life (it is posted in the resources section)
All you need to do is the following:
CLI Remote name spoofing
-- edit with your own algo
local function generateID(seed)
return "" .. game:GetService("HttpService"):GenerateGUID(false) .. "" .. Random.new(seed):NextNumber()
end
and for the lines to modify, do not edit the server code only the client code:
-- 182 -> 214
for _, remoteEventName in pairs(REMOTE_EVENT_NAMES) do
coroutine.wrap(function()
local remoteEvent = networkFolder:WaitForChild(remoteEventName, math.huge)
local callback = NetworkingCallbacks[remoteEventName]
if callback then
WeaponsSystem.connections[remoteEventName .. "Remote"] = remoteEvent.OnClientEvent:Connect(function(...)
callback(...)
end)
end
remoteEvent.Name = generateID(1e2)
WeaponsSystem.remoteEvents[remoteEventName] = remoteEvent
end)()
end
for _, remoteFuncName in pairs(REMOTE_FUNCTION_NAMES) do
coroutine.wrap(function()
local remoteFunc = networkFolder:WaitForChild(remoteFuncName, math.huge)
local callback = NetworkingCallbacks[remoteFuncName]
if callback then
remoteFunc.OnClientInvoke = function(...)
return callback(...)
end
end
remoteEvent.Name = generateID(1e2)
WeaponsSystem.remoteFunctions[remoteFuncName] = remoteFunc
end)()
end
Packet flood defence
I have also added anti packet flooding measures to my version of the code too.
Code to edit, this is for the server:
-- 112 - 161
for _, remoteEventName in pairs(REMOTE_EVENT_NAMES) do
local remoteEvent = Instance.new("RemoteEvent")
remoteEvent.Name = remoteEventName
remoteEvent.Parent = networkFolder
local callback = NetworkingCallbacks[remoteEventName]
if not callback then
--Connect a no-op function to ensure the queue doesn't pile up.
warn("There is no server callback implemented for the WeaponsSystem RemoteEvent \"%s\"!")
warn("A default no-op function will be implemented so that the queue cannot be abused.")
callback = function() end
end
WeaponsSystem.connections[remoteEventName .. "Remote"] = remoteEvent.OnServerEvent:Connect(function(player, ...)
if PacketLimiter:Check(player, networkFolder:FindFirstChild(remoteEventName..""), 100, remoteEventName.."Remote") and ... then
callback(player, ...)
else
print("kicking for flood")
player:Kick("packet flooding")
end
end)
WeaponsSystem.remoteEvents[remoteEventName] = remoteEvent
end
for _, remoteFuncName in pairs(REMOTE_FUNCTION_NAMES) do
local remoteFunc = Instance.new("RemoteEvent")
remoteFunc.Name = remoteFuncName
remoteFunc.Parent = networkFolder
local callback = NetworkingCallbacks[remoteFuncName]
if not callback then
--Connect a no-op function to ensure the queue doesn't pile up.
warn("There is no server callback implemented for the WeaponsSystem RemoteFunction \"%s\"!")
warn("A default no-op function will be implemented so that the queue cannot be abused.")
callback = function() end
end
remoteFunc.OnServerInvoke = function(player, ...)
if PacketLimiter:Check(player, networkFolder:FindFirstChild(remoteEventName..""), 100, remoteEventName.."Remote") and ... then
return callback(player, ...)
else
print("kicking for flood")
player:Kick("packet flooding")
return nil
end
end
WeaponsSystem.remoteFunctions[remoteFuncName] = remoteFunc
end
networkFolder.Parent = WeaponsSystemFolder
WeaponsSystem.networkFolder = networkFolder
PacketLimiter module:
Place in server storage please.
local PacketLimiter = {}
local Packets = {}
function PacketLimiter:Check(Player_Object, Remote, RatePerSec, Unique_Identifier)
local Rate = RatePerSec or 10
local Identifier = Unique_Identifier or "Identifier"
if not Packets[Player_Object] then
Packets[Player_Object] = {}
local connection
local function PlayerLeft(player)
if player == Player_Object then
Packets[Player_Object] = nil
connection:Disconnect()
end
end
connection = game.Players.PlayerRemoving:Connect(PlayerLeft)
end
if not Packets[Player_Object][Remote] then
Packets[Player_Object][Remote] = {}
end
if not Packets[Player_Object][Remote][Identifier] then
Packets[Player_Object][Remote][Identifier] = {}
end
if Rate > 1 then
if Packets[Player_Object][Remote][Identifier]["Count"] then
local TimeElapsed = tick() - Packets[Player_Object][Remote][Identifier]["StartTime"]
if TimeElapsed >= 1 then
Packets[Player_Object][Remote][Identifier]["Count"] = 1
Packets[Player_Object][Remote][Identifier]["StartTime"] = tick()
return true
else
Packets[Player_Object][Remote][Identifier]["Count"] = Packets[Player_Object][Remote][Identifier]["Count"] + 1
return Packets[Player_Object][Remote][Identifier]["Count"] <= Rate
end
else
Packets[Player_Object][Remote][Identifier]["Count"] = 1
Packets[Player_Object][Remote][Identifier]["StartTime"] = tick()
return true
end
end
if Rate <= 1 then
if Packets[Player_Object][Remote][Identifier]["LastTime"] then
local TimeElapsed = tick() - Packets[Player_Object][Remote][Identifier]["LastTime"]
if TimeElapsed >= (1/Rate) then
Packets[Player_Object][Remote][Identifier]["LastTime"] = tick()
return true
else
return false
end
else
Packets[Player_Object][Remote][Identifier]["LastTime"] = tick()
return true
end
end
end
return PacketLimiter