Anti-Exploit script isn’t working. I’ve debugged with “print()” throughout just about every line. There is no error that is shown in the output.
Also, I should mention this now that it’s not kicking the player either.
local APIModule = require(game.ReplicatedStorage.ToDiscord)
local newWebHook = APIModule.new("*******","*******")
game.Players.PlayerAdded:Connect(function(player)
while true do
wait()
local bruh1 = false
if player.Character.Humanoid.WalkSpeed >= 21 and bruh1 == false then
bruh1 = true
player:Kick("Speeding/Exploiting. If you think this was an error get a hold of a moderator of the game.")
newWebHook:post{
username = "Anti-Cheat",
content = "**" .. player.Name .. "** ```has attempted to speed.```\n Player speed was: "..player.Character.Humanoid.WalkSpeed
}
bruh1 = false
end
end
end)
I’ve turned this into a LocalScript, it did kick the player, but did not send the message to discord, for obvious reasons.
local webhook = {}
webhook.__index = webhook
function webhook.new(id,key)
local mt = setmetatable({id=id,key=key}, webhook)
return mt
end
function webhook:post(config,host)
local data = nil
local success = pcall(function()
data = game:GetService("HttpService"):JSONEncode(config)
end)
if not success then warn("Webhook can't be converted to JSON") return end
game:GetService("HttpService"):PostAsync("https://discordapp.com/api/webhooks/"..self.id.."/"..self.key,data)
end
return webhook
local APIModule = require(game.ReplicatedStorage.ToDiscord)
local newWebHook = APIModule.new("*******","*******")
local bruh1 = false
script.Parent.Touched:Connect(function(Touched)
local Player
if Touched.Parent:WaitForChild("Humanoid") then
Player = Touched.Parent
elseif Touched.Parent.parent:WaitForChild("Humanoid") then
Player = Touched.Parent.Parent
end
local player = game.Players:GetPlayerFromCharacter(Player)
if bruh1 == false then
bruh1 = true
local Height = Player.HumanoidRootPart.Position.Y
player:Kick("Reached Height Limit/Exploiting. If you think this was an error get a hold of a moderator of the game.")
newWebHook:post{
username = "Anti-Cheat",
content = "**" .. Player.Name .. "** ```has attempted to fly or reached the height limit.```\n Player height was: "..Height.." studs"
}
bruh1 = false
end
end)
Try using a proxy, as far as I know, discord blocks roblox webhooks.
Try using osyris’s proxy server.
https://discord.osyr.is/
local webhook = {}
webhook.__index = webhook
function webhook.new(id,key)
local mt = setmetatable({id=id,key=key}, webhook)
return mt
end
function webhook:post(config,host)
local data = nil
local success = pcall(function()
data = game:GetService("HttpService"):JSONEncode(config)
end)
if not success then warn("Webhook can't be converted to JSON") return end
game:GetService("HttpService"):PostAsync("https://discord.osyr.is/api/webhooks/"..self.id.."/"..self.key,data)
end
return webhook
- removed quote to respect privacy -
Anybody can use this information and start posting to your webhook. Delete the current webhook and create a new one.
How are you changing the player’s walkspeed, it doesn’t replicate from the client… so an exploiter changing their walkspeed wouldn’t replicate and it wouldn’t do anything, trying using magnitude on the velocity and ignore the Y value.
When I tested it in studio, it was saying that the character was a nil value, this is mainly because the character and player are added at different times and you need to wait for the player’s character to be added to the workspace.
To fix this, I have added a CharacterAdded event inside of the PlayerAdded event so the script will be working once the Player’s character has loaded into the game.
I have also added a variable that stores the player’s walkspeed before the player is kicked as sometimes I encounter problems where the player’s data is deleted before logged as the player’s character is no longer in workspace.
New Script
local APIModule = require(game.ReplicatedStorage.ToDiscord)
local newWebHook = APIModule.new("","")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
while true do
wait()
local bruh1 = false
local humanoid = char:WaitForChild("Humanoid")
if humanoid.WalkSpeed >= 21 and bruh1 == false then
bruh1 = true
local kickSpeed = humanoid.WalkSpeed
player:Kick("Speeding/Exploiting. If you think this was an error get a hold of a moderator of the game.")
newWebHook:post{
username = "Anti-Cheat",
content = "**" .. player.Name .. "** ```has attempted to speed.```\n Player speed was: "..kickSpeed
}
bruh1 = false
end
end
end)
end)
I also noticed that the webhook is sent multiple times, you may want to add something so the message is only sent once.
Funny thing about exploits, the client is only able to see the values it change. Whatever the exploit changes the walkspeed value to will not be visible to the server.
@Afraid4Life@Vaizu When exploiters change their walkspeed property (on the client), it does not replicate to the server. You can use the Running event of the humanoid suggested by @metaindex but a lot of exploiters use scripts that bypass that. To mitigate this, you should read this thread by @Intended_Pun which teaches you the basics of protecting your game from speed-hackers.
The script works fine the only thing it needs is a break to end the if statement.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
while true do
wait()
local bruh1 = false
local humanoid = char:WaitForChild("Humanoid")
if humanoid.WalkSpeed >= 21 and bruh1 == false then
bruh1 = true
local kickSpeed = humanoid.WalkSpeed
player:Kick("Speeding/Exploiting. If you think this was an error get a hold of a moderator of the game.")
APIModule:post{
username = "Anti-Cheat",
content = "**" .. player.Name .. "** ```has attempted to speed.```\n Player speed was: "..kickSpeed
}
bruh1 = false
break -- This stops the if statement. This is to prevent discord webhook spamming.
end
end
end)
end)