Anti Abuse System | Source Code

Server Script:

local MinPercentage = 70
local MinRole = 2
local GroupId = 10392184


local Characters = 0
local UppercaseCharacters = 0
local Percentage =0
local WarnFunction = game:GetService("ReplicatedStorage").WarningSystem:WaitForChild("Warn")

local function Punish(player)
	local Punishment = WarnFunction:InvokeClient(player)
	Characters  = 0
	Percentage = 0
	UppercaseCharacters = 0
end

local function CheckWord(String, player)
	for _, v in ipairs(String:split("")) do
		Characters += 1
		if v ~= v:lower() then 
			UppercaseCharacters += 1
		end
	end
	local Percentage = math.floor((UppercaseCharacters)/(Characters) * 100)
	if Percentage >= MinPercentage then
		Punish(player)
	end
end

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(text)
		if player:GetRankInGroup(GroupId) <= MinRole then
			CheckWord(text, player)
		end
	end)
end)

Local Script:

local WarnFunction = game:GetService("ReplicatedStorage").WarningSystem:WaitForChild("Warn")
local WarningCount = 0
local MaxWarnings = 3
local StarterGui = game:GetService("StarterGui")

local function Notification(Desc)
	StarterGui:SetCore("SendNotification", {
		Title = "WARNING",
		Text = Desc
	})
end

local function Warn()
	WarningCount = WarningCount +1
	if WarningCount >= MaxWarnings then
		game.Players.LocalPlayer:Kick("You have reached max warnings!")
	else
		Notification("You have "..MaxWarnings - WarningCount.." warnings left, please do not continue to abuse!")
	end
end

WarnFunction.OnClientInvoke = Warn

If you have any issues feel free to make a post in #scripting-support

2 Likes

This topic was automatically closed 1 minute after the last reply. New replies are no longer allowed.