A couple of weeks ago I made a new and kind of efficient way to detect and prevent basic exploits in games. I’ve been further developing it to do better and implemented it to send chat messages and Discord messages when the player is kicked (not shown in code below) However, to prove that it is really as effective and efficient as it could be, I need feedback from other creators.
The code below takes place in one script located in ServerScriptservice, so no need to worry about client issues. Any feedback is appreciated!
local BannedObjects = {"BodyGyro", "BodyPosition", "BodyForce"}
local BodyParts = {"Head", "Torso", "Left Arm", "Right Arm", "Left Leg", "Right Leg", "HumanoidRootPart"}
local AllowedGuis = {"BubbleChat", "Chat", "Freecam", "ChatMessageHandler", "ChatInstallVerifier", "OtherGuiNamesHere", "SetupQuickJoiners", "HDAdminGUIs"} -- These guis are automatically inserted into the PlayerGui so I included them here
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
if Humanoid.WalkSpeed ~= 16 then
Player:Kick("Your WalkSpeed changed to "..Humanoid.WalkSpeed)
end
end)
Character.DescendantAdded:Connect(function(Descendant)
if table.find(BannedObjects, Descendant.ClassName) then
Player:Kick("A "..Descendant.ClassName.." was found in your "..Descendant.Parent.Name..".")
end
end)
Character.ChildRemoved:Connect(function(Child)
if Humanoid and Humanoid.Health ~= 0 then
if table.find(BodyParts, Child.Name) then
Player:Kick("You were trying to remove your "..Child.Name..".")
end
end
end)
end)
Player.PlayerGui.ChildAdded:Connect(function(ScreenGui)
if not table.find(AllowedGuis, ScreenGui.Name) then
Player:Kick(ScreenGui.Name.." was found in your PlayerGui.")
end
end)
end)