Discord API anti-cheat system

Mind showing me the Module? I don’t have access to the API?

1 Like

I would advise against using discord as this could class as a “logging system” and yes, as said above please send the API.

1 Like
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

I am pretty sure roblox IP’s are blocked on discord’s servers.

It works with my other height limit script.

The height script
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

Remove your webhook information

1 Like

Roblox is no longer on Discord’s restricted list.

What do you mean by “webhook information” which webhook information?

They haven’t been blocked in over a year or so.

1 Like

- 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.

2 Likes

YIKES forgot to take out that! thank you

1 Like

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.

2 Likes

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.

2 Likes
humanoid.Running:Connect(function(speed)
    if math.floor(speed )> 90 then
        webhook:Post()
    end
end
3 Likes

@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.

2 Likes

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)

The break will prevent more than post to be sent.

the walkspeed property doesnt replicate to the server, you have to use magnitude or velocity checks in order to determine speed hacking.

:pensive:

also @metryy gave some examples to help you

1 Like

This works, but it detects that im exploiting as soon as I load in.