local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local IsHacking = ReplicatedStorage.Remotes.IsHacking
local SendMessage = ReplicatedStorage.Remotes.SendMessage
local Hack
local Debounce = false
local Message = require(script.Parent.Message)
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.Running:Connect(function(Speed)
if Speed > Humanoid.WalkSpeed + 10 and not Debounce then
local Hack = "Speed Hacked"
Debounce = true
IsHacking:FireClient(Player, Hack, Humanoid.WalkSpeed)
Player.Stats.KickStrikes.Value = Player.Stats.KickStrikes.Value + 1
if Player.Stats.KickStrikes.Value >= 4 then
Player.Stats.BanStrikes.Value = Player.Stats.BanStrikes.Value + 1
Player:Kick("You have been kicked for hacking")
Message.SendMessage(SendMessage, Player, " Has been kicked ", Hack)
else
Message.SendMessage(SendMessage, Player, " Has ", Hack)
wait(5)
Debounce = false
print("Nope")
end
end
end)
end)
end)
It runs and prints hes hacked once, then 2 more times, then 3 more times ect. I added a debounce but still am getting the duplicates.
I fixed it, I had to change the remote handler script.
Instead of using Humanoid.Running, try this
humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
if humanoid.WalkSpeed ~= 16 then
player:Kick()
end
end)
Coming to your script
if Player.Stats.KickStrikes.Value >= 4 then
Player.Stats.BanStrikes.Value = Player.Stats.BanStrikes.Value + 1
Player:Kick("You have been kicked for hacking")
Message.SendMessage(SendMessage, Player, " Has been kicked ", Hack)
--No Debounce here
else
Message.SendMessage(SendMessage, Player, " Has ", Hack)
wait(5)
Debounce = false -- Here it is set to false
print("Nope") end
The debounce is only set to false if the Player is not speed hacking, but if the player is speed hacking, it is not set to false. That might be giving you that result.
Just so you’re aware, this anti-exploit will be completely ineffective at catching speed hackers.
The “WalkSpeed” property, when changed on the client, isn’t replicated to the server. It’s a server-authoritative value, however if the client changes it locally, they can change what their character controller perceives as their WalkSpeed, and hence the result is a speedhack.
Instead, you’d do better (if you really need to stop speed hackers) to measure the velocity of the players by checking the distance between positions over time, calculating their speed from that (Speed = Distance / Time
(at non-relativistic speeds, so if your characters are trying to test the limits of Einstein’s Theory of Relativity, you’re out of luck))
Hope this helps
Well, Thanks for correcting me!