I recently have been working on an Anti-Exploit Script mainly for the fun of trying new coding experience.
I’ve been wondering what is the best way of going about to script the Hardest parts of the anti exploit script.
- Anti-Fly
- Anti-NoClip
I know their are lots of flaws, and ways of going around to check on how to do this. Currently my code is dog water, but still something.
How I set it up^
What is included -
- Discord Webhooks.
- Banned Table to keep banned kids out of game.
- Server Messages to let other players know.
MODULE SCRIPT -
--[[
@author TwinPlayzDev_YT
@since 8/2/2021
░A░N░T░I░-░E░X░P░L░O░I░T░
This code is free to use to all.
youtube.com/TwinPlayz_YT
THIS SCRIPT MANAGES THE SETTINGS OF THE EXPLOIT SYSTEM.
Feel free to watch my video for more explanation.
--]]
--[[ MODULE ]]--
local settings = {
AntiBtools = true; -- This will remove building tools from all players.
AntiFly = true; -- Stop players from flying around.
AntiSpeed = true; -- Stop players from speeding around.
MaxSpeed = 35; -- Set this to the amount of speed you want.
AntiNoClip = true; -- Checks if players are using No Clip.
AntiNaked = false; -- Check if any players are naked.
AntiFovChange = true; -- Changes FOV if it was changed.
FieldofView = 70; -- Default FOV
AntiVeryLoudMusic = true; -- Will change music if it is higher than Max.
MaxMusicVolume = 5; -- Max Music Volume (Max = 10)
AntiInvisible = true; -- Kick players if they are invisible
AntiFog = true; -- This will keep the default fog.
FogStart = 0; -- Default Fog
FogEnd = 100000; -- Default Fog
AntiGodMode = true; -- This will kick players if they are using godmode.
MaxHealth = 100; -- change to max health 200 = default
AntiJumpPower = true; -- Will See if player jumping high.
MaxJumpPower = 50; -- Default JumpPower
AllowedPeople = { -- This is for the people that get bypassed of Anti-Exploit. (Admins, owners, etc.)
"TwinPlayzDev_YT",
"ADMIN",
"MOD",
"SPECIAL"
};
BannedTools = { -- This is for the banned tools, you can make much more! (Rockets, guns, etc.)
"Hammer",
"Btools",
"Building Tools",
"Sword"
};
}
return settings
SERVER SCRIPT -
--[[
@author TwinPlayzDev_YT
@since 8/2/2021
░A░N░T░I░-░E░X░P░L░O░I░T░
This code is free to use to all.
youtube.com/TwinPlayz_YT
Feel free to watch my video for more explanation.
--]]
--[[ SERVICES ]]--
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Replicated Storage Service
local http = game:GetService("HttpService") -- HTTP Service
local Lighting = game:GetService("Lighting") -- Lighting Service
--[[ LOCALS ]]--
local settingsModule = require(script.Settings) -- Getting The Settings Module
--local exploitModule = require(script.Settings.ExploitChecks) -- Getting The Exploit Module
local bannedlist = {} -- Making A Banned List
local MessageEvent = ReplicatedStorage:WaitForChild("ExploitAlert") -- Exploit Event
local Sound = game.Workspace:WaitForChild("Sound") -- Local Sound
local FogStart = Lighting.FogStart -- Fog Start
local FogEnd = Lighting.FogEnd -- Fog End
--[[ FUNCTIONS ]]--
game.Players.PlayerAdded:connect(function(Player) -- This is to check if players has been banned. If So They will be kicked.
for a = 1,#bannedlist do
if Player.Name == bannedlist[a] then
Player:Kick()
end
end
end)
while true do
wait(1)
Players = game.Players:GetChildren()
for index, player in pairs(Players) do
if settingsModule.AllowedPeople[player.Name] then -- If any player is an Admin, they will not be affected.
return
else -- Other Players
--[[ PLAYER LOCALS ]]--
local Character = player.Character or player.CharacterAdded:Wait() -- LOCAL CHARACTER
local Humanoid = Character:FindFirstChild("Humanoid") -- LOCAL HUMANOID
local Speed = Humanoid.WalkSpeed -- LOCAL SPEED
local JumpPower = Humanoid.JumpPower -- LOCAL JUMPPOWER
local MaxHealth = Humanoid.MaxHealth -- LOCAL MAXHEALTH
local backPack = player:WaitForChild("Backpack") -- Backpack
--[[ DIZZY LOCALS ]]--
local date = os.date("!*t") -- Getting The Date
local Data = { -- Making A Hacking Message
["content"] = player.Name.." ,was just banned from a server for hacking. | "..date.month.."/"..date.day.."/"..date.year
}
local Data2 = { -- Making Another Hacking Message
["content"] = player.Name.." ,was just caught for trying to use btools. | "..date.month.."/"..date.day.."/"..date.year
}
Data = http:JSONEncode(Data)
Data2 = http:JSONEncode(Data2)
local webhook = ""
--[[SPEED CHECK]]--
if settingsModule.AntiSpeed == true then
if Speed >= settingsModule.MaxSpeed then
table.insert(bannedlist,player.Name)
player:Kick("Kicked For Speed Hacking.")
http:PostAsync(webhook, Data)
MessageEvent:FireAllClients({
Text = "[Anti-Exploit] "..Character.Name.." has been banned from the server because of speedhacking."; -- Message
Color = Color3.fromRGB(255, 195, 43); -- Color
Font = Enum.Font.SourceSansBold; -- Font
FontSize = Enum.FontSize.Size18; -- Size
})
end
end
--[[JUMP CHECK]]--
if settingsModule.AntiJumpPower == true then
if JumpPower > settingsModule.MaxJumpPower then
table.insert(bannedlist,player.Name)
player:Kick("Kicked For Jump Hacking.")
http:PostAsync(webhook, Data)
MessageEvent:FireAllClients({
Text = "[Anti-Exploit] "..Character.Name.." has been banned from the server because of jumphacking."; -- Message
Color = Color3.fromRGB(255, 195, 43); -- Color
Font = Enum.Font.SourceSansBold; -- Font
FontSize = Enum.FontSize.Size18; -- Size
})
end
end
--[[GODMODE CHECK]]--
if settingsModule.AntiGodMode == true then
if MaxHealth > settingsModule.MaxHealth then
table.insert(bannedlist,player.Name)
player:Kick("Kicked For God Mode Hacking.")
http:PostAsync(webhook, Data)
MessageEvent:FireAllClients({
Text = "[Anti-Exploit] "..Character.Name.." has been banned from the server because of god mode hacking."; -- Message
Color = Color3.fromRGB(255, 195, 43); -- Color
Font = Enum.Font.SourceSansBold; -- Font
FontSize = Enum.FontSize.Size18; -- Size
})
end
end
--[[FLY CHECK]]--
if settingsModule.AntiFly == true then
if Humanoid:GetState() == Enum.HumanoidStateType.Flying then
table.insert(bannedlist,player.Name)
player:Kick("Kicked For Fly Hacking.")
http:PostAsync(webhook, Data)
MessageEvent:FireAllClients({
Text = "[Anti-Exploit] "..Character.Name.." has been banned from the server because of fly hacking."; -- Message
Color = Color3.fromRGB(255, 195, 43); -- Color
Font = Enum.Font.SourceSansBold; -- Font
FontSize = Enum.FontSize.Size18; -- Size
})
end
end
--[[BTOOLS CHECK]]--
if settingsModule.AntiBtools == true then
backPack.ChildAdded:Connect(function(tool)
if tool:IsA("Tool") then
if settingsModule.BannedTools[tool.Name] then
http:PostAsync(webhook, Data2)
tool:Destroy()
MessageEvent:FireAllClients({
Text = "[Anti-Exploit] "..Character.Name.." tried to use a banned tool, but had it removed."; -- Message
Color = Color3.fromRGB(85, 255, 0); -- Color
Font = Enum.Font.SourceSansBold; -- Font
FontSize = Enum.FontSize.Size18; -- Size
})
end
end
end)
end
--[[NOCLIP CHECK]]--
if settingsModule.AntiNoClip == true then
if Humanoid:GetState() == Enum.HumanoidStateType.StrafingNoPhysics then
table.insert(bannedlist,player.Name)
player:Kick("Kicked For No-Clip Hacking.")
http:PostAsync(webhook, Data)
MessageEvent:FireAllClients({
Text = "[Anti-Exploit] "..Character.Name.." has been banned from the server because of no-clip hacking."; -- Message
Color = Color3.fromRGB(255, 195, 43); -- Color
Font = Enum.Font.SourceSansBold; -- Font
FontSize = Enum.FontSize.Size18; -- Size
})
end
end
--[[NAKED CHECK]]--
if settingsModule.AntiNaked == true then
if not Character:FindFirstChildOfClass("Shirt") and Character:FindFirstChildOfClass("Pants") then
player:LoadCharacter()
end
end
--[[FOV CHECK]]--
local Camera = workspace.CurrentCamera
if settingsModule.AntiFovChange == true then
if Camera.FieldOfView > settingsModule.FieldofView then -- Greater than field of view
Camera.FieldOfView = settingsModule.FieldofView -- Set it back to original
MessageEvent:FireAllClients({
Text = "[Anti-Exploit] "..Character.Name.." - Camera has been adjusted."; -- Message
Color = Color3.fromRGB(255, 0, 127); -- Color
Font = Enum.Font.SourceSansLight; -- Font
FontSize = Enum.FontSize.Size18; -- Size
})
elseif Camera.FieldOfView < settingsModule.FieldofView then -- Less than field of view
Camera.FieldOfView = settingsModule.FieldofView -- Set it back to original
MessageEvent:FireAllClients({
Text = "[Anti-Exploit] "..Character.Name.." - Camera has been adjusted."; -- Message
Color = Color3.fromRGB(255, 0, 127); -- Color
Font = Enum.Font.SourceSansLight; -- Font
FontSize = Enum.FontSize.Size18; -- Size
})
end
end
--[[MUSIC CHECK]]--
if settingsModule.AntiVeryLoudMusic == true then
if Sound.Volume >= settingsModule.MaxMusicVolume then
Sound.Volume = settingsModule.MaxMusicVolume
MessageEvent:FireAllClients({
Text = "[Anti-Exploit] "," - Music has been adjusted."; -- Message
Color = Color3.fromRGB(170, 85, 255); -- Color
Font = Enum.Font.SourceSansLight; -- Font
FontSize = Enum.FontSize.Size18; -- Size
})
end
end
--[[INVISIBLE CHECK]]--
if settingsModule.AntiInvisible == true then
for i,Child in pairs(Character:GetChildren()) do
if Child:IsA("MeshPart") and Child.Transparency == 1 then
if Child:IsA("Part") and Child.Transparency == 1 then
if Child:IsA("Accessory") then
for i,Child in pairs(Child:GetChildren()) do
if Child:IsA("Part") and Child.Transparency == 1 then
table.insert(bannedlist,Players[i].Name)
Players[i]:Kick("Kicked For Invisible Hacking.")
http:PostAsync(webhook, Data)
MessageEvent:FireAllClients({
Text = "[Anti-Exploit] "..Character.Name.." has been banned from the server because of invisible hacking."; -- Message
Color = Color3.fromRGB(255, 195, 43); -- Color
Font = Enum.Font.SourceSansBold; -- Font
FontSize = Enum.FontSize.Size18; -- Size
})
end
end
end
end
end
end
end
--[[FOG CHECK]]--
if settingsModule.AntiFog == true then
if FogEnd < settingsModule.FogEnd then
FogEnd = settingsModule.FogEnd
if FogStart > settingsModule.FogStart then
FogStart = settingsModule.FogStart
MessageEvent:FireAllClients({
Text = "[Anti-Exploit] "," - Fog has been adjusted."; -- Message
Color = Color3.fromRGB(255, 255, 255); -- Color
Font = Enum.Font.SourceSansLight; -- Font
FontSize = Enum.FontSize.Size18; -- Size
})
end
end
end
end
end
wait(0.25)
script.Name = http:GenerateGUID(false) -- Constantly change the name to make it much harder for exploiters to delete the script.
end
One problem:
If anyone knows how I can actually get it to NOT effect owners, I still don’t understand why this -
if settingsModule.AllowedPeople[player.Name] then -- If any player is an Admin, they will not be affected.
return
else -- Other Players
is not working…
ANY ADVICE HELPS!