Loop through each letter, and check if the letter is equal to itself converted to lowercase. Something like this:
local message = "aBcDeF"
local numberOfUppercaseLetters = 0
for i = 1, #message do
local character = message:sub(i,i)
if not (character == character:lower()) then
--Character is uppercase!
numberOfUppercaseLetters += 1
end
end
print("Message has",numberOfUppercaseLetters,"uppercase letters.")
Using this, I can try to make an anti-capital system.
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
local upperCase = 0
for i = 1,message:len() do
if not message:sub(i,i) == message:sub(i,i):lower() then
upperCase += 1
end
end
if upperCase >= 6 then
--Punish the player somehow
end
end)
end)