local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HttpService = game:GetService("HttpService")
local RunService = game:GetService("RunService")
local securityFolder = ReplicatedStorage:FindFirstChild("SecuritySystem")
if not securityFolder then
securityFolder = Instance.new("Folder")
securityFolder.Name = "SecuritySystem"
securityFolder.Parent = ReplicatedStorage
end
local heartbeatRemote = securityFolder:FindFirstChild("HeartbeatRemote")
if not heartbeatRemote then
heartbeatRemote = Instance.new("RemoteEvent")
heartbeatRemote.Name = "HeartbeatRemote"
heartbeatRemote.Parent = securityFolder
end
local keyExchangeRemote = securityFolder:FindFirstChild("KeyExchangeRemote")
if not keyExchangeRemote then
keyExchangeRemote = Instance.new("RemoteFunction")
keyExchangeRemote.Name = "KeyExchangeRemote"
keyExchangeRemote.Parent = securityFolder
end
local function simpleEncrypt(str, key)
local result = ""
for i = 1, #str do
local byte = string.byte(str, i)
result = result .. string.char(bit32.bxor(byte, key))
end
return result
end
local guiData = Instance.new("StringValue")
guiData.Name = "GuiCheckData"
local key = 42
local data = {
guiName = simpleEncrypt("CommandMenufly", key),
allowedChildren = {
simpleEncrypt("UICorner", key),
simpleEncrypt("MainFrame", key),
simpleEncrypt("DragBar", key)
}
}
guiData.Value = HttpService:JSONEncode(data)
guiData.Parent = securityFolder
local playerSecurity = {}
local serverSecrets = {
baseKey = 7531,
saltKey = 9241,
rotationKey = 4687
}
local function generatePlayerKey(userId, timestamp)
local seed = (userId * serverSecrets.baseKey + timestamp *
serverSecrets.saltKey) % 999999
math.randomseed(seed)
local dynamicKey = math.random(100000, 999999)
math.randomseed(tick())
return dynamicKey
end
local function advancedEncrypt(userId, timestamp, playerKey)
local step1 = (userId + timestamp) * serverSecrets.rotationKey
local step2 = step1 + playerKey
local step3 = step2 % 1000000
local step4 = step3 + (userId % 100) * (timestamp % 100)
return step4 % 999999
end
local function getSecureTimestamp()
return math.floor(tick() * 100) % 1000000
end
local function onPlayerAdded(player)
playerSecurity[player.UserId] = {
playerKey = math.random(100000, 999999),
lastHeartbeat = tick(),
strikes = 0,
keyRotationTimer = 0,
validTimestamps = {},
failedAttempts = 0
}
wait(5)
if not player.Parent then return end
spawn(function()
while player.Parent and playerSecurity[player.UserId] do
wait(6)
local security = playerSecurity[player.UserId]
if not security then break end
security.keyRotationTimer = security.keyRotationTimer + 6
if security.keyRotationTimer >= 30 then
security.playerKey = math.random(100000, 999999)
security.keyRotationTimer = 0
end
local timeSinceLastHeartbeat = tick() - security.lastHeartbeat
if timeSinceLastHeartbeat > 5 then
security.strikes = security.strikes + 1
print("no hell no")
if security.strikes >= 2 then
warn("❌ " طرد.. player.Name .. " - )"انقطاع االتصال
player:Kick("nouza heart not loaded")
break
end
end
end
end)
end
local function onPlayerRemoving(player)
playerSecurity[player.UserId] = nil
print("Good bye didy i'll miss u" .. player.Name)
end
keyExchangeRemote.OnServerInvoke = function(player)
local security = playerSecurity[player.UserId]
if not security then return nil end
local timestamp = getSecureTimestamp()
local tempKey = generatePlayerKey(player.UserId, timestamp)
local encryptedResponse = {
key = tempKey,
timestamp = timestamp,
hash = (tempKey + timestamp + player.UserId) % 100000
}
return encryptedResponse
end
heartbeatRemote.OnServerEvent:Connect(function(player, encryptedData,
clientTimestamp)
local security = playerSecurity[player.UserId]
if not security then
warn("⚠️ heartbeat 😱: " .. player.Name)
return
end
local warnCount = security.warnCount or 0
if not clientTimestamp or type(clientTimestamp) ~= "number" then
security.failedAttempts = security.failedAttempts + 1
warn("⚠️ timestamp not true lil kid " .. player.Name)
warnCount = warnCount + 1
security.warnCount = warnCount
if warnCount >= 4 then
player:Kick("4 warnings detected - Access terminated")
end
return
end
for _, oldTimestamp in pairs(security.validTimestamps) do
if clientTimestamp == oldTimestamp then
security.failedAttempts = security.failedAttempts + 2
warn("⚠️ " .. player.Name)
warnCount = warnCount + 1
security.warnCount = warnCount
if warnCount >= 4 then
player:Kick("4 warnings detected - Access terminated")
end
if security.failedAttempts >= 5 then
player:Kick("Multiple failed attempts")
end
return
end
end
local playerKey = generatePlayerKey(player.UserId, clientTimestamp)
local expectedValue = advancedEncrypt(player.UserId, clientTimestamp,
playerKey)
if encryptedData == expectedValue then
security.lastHeartbeat = tick()
security.strikes = math.max(0, security.strikes - 1)
security.failedAttempts = math.max(0, security.failedAttempts - 1)
table.insert(security.validTimestamps, clientTimestamp)
if #security.validTimestamps > 5 then
table.remove(security.validTimestamps, 1)
end
print("💓 nouza heartbeat sended " .. player.Name)
security.warnCount = 0
else
security.strikes = security.strikes + 2
security.failedAttempts = security.failedAttempts + 1
warn("😱theres no heartbeat 😱 im dead " .. player.Name .. " (nice try
didy: " .. security.failedAttempts .. ")")
warnCount = warnCount + 1
security.warnCount = warnCount
if warnCount >= 4 then
player:Kick("4 warnings detected - Access terminated")
end
if security.failedAttempts >= 5 or security.strikes >= 6 then
warn("trys to bypass " .. player.Name .. " - nice try supper
didy")
player:Kick("Multiple failed attempts or bypass detected")
end
end
end)
Players.PlayerAdded:Connect(onPlayerAdded)
Players.PlayerRemoving:Connect(onPlayerRemoving)