Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- AntiFling Script (English Version)
- -- Place this Script inside ServerScriptService
- local Players = game:GetService("Players")
- -- Configuration limits
- local MAX_LINEAR_VELOCITY = 100 -- maximum normal speed
- local MAX_ROTATION_VELOCITY = 100 -- maximum normal rotation
- local CHECK_INTERVAL = 1 -- seconds between checks
- local MAX_VIOLATIONS = 3 -- kick after how many detections
- local VIOLATION_RESET_TIME = 30 -- reset violation counter after 30 seconds
- local violations = {} -- [userId] = {count, lastCheck}
- local function protectCharacter(player, character)
- task.wait(1) -- wait for character to load
- local humanoidRoot = character:FindFirstChild("HumanoidRootPart")
- if not humanoidRoot then return end
- while character.Parent do
- local vel = humanoidRoot.AssemblyLinearVelocity.Magnitude
- local rot = humanoidRoot.AssemblyAngularVelocity.Magnitude
- if vel > MAX_LINEAR_VELOCITY or rot > MAX_ROTATION_VELOCITY then
- -- Reset abnormal velocity
- humanoidRoot.AssemblyLinearVelocity = Vector3.new(0,0,0)
- humanoidRoot.AssemblyAngularVelocity = Vector3.new(0,0,0)
- -- Record violation
- local userId = player.UserId
- local now = tick()
- local rec = violations[userId]
- if not rec or now - rec.lastCheck > VIOLATION_RESET_TIME then
- rec = {count = 0, lastCheck = now}
- violations[userId] = rec
- end
- rec.count = rec.count + 1
- rec.lastCheck = now
- warn(("[AntiFling] %s (%d) suspected of fling! Count=%d"):format(player.Name, userId, rec.count))
- if rec.count >= MAX_VIOLATIONS then
- player:Kick("You have been detected using fling/exploit.")
- end
- end
- task.wait(CHECK_INTERVAL)
- end
- end
- Players.PlayerAdded:Connect(function(player)
- player.CharacterAdded:Connect(function(char)
- protectCharacter(player, char)
- end)
- end)
- Players.PlayerRemoving:Connect(function(player)
- violations[player.UserId] = nil
- end)
Advertisement
Add Comment
Please, Sign In to add comment