3

# Check if a players age is over 13? [closed]

I know there is Player GetUnder13 but I cannot use that...

Does anyone know how a game can check if user is under or over 13?

### Locked by User#24403

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

10
XAXA 1569
6 years ago

It is possible to check if the player is 13+ with a neat trick: use FilterStringForPlayerAsync!

According to the wiki article for FilterStringForPlayerAsync:

Filters a string appropriate to the given player's age settings, so they see what is appropriate to them. This function will only work if called from a Script on the server. If called on a client it will fail.

After testing this with several "naughty words" on two different accounts (my account, which is 13+, and a dummy account that is <13, I came up with several words that get filtered differently between the two, the most benign of which is suck.

On a 13+ account:

> print(game:GetService("Chat"):FilterStringForPlayerAsync("suck", player))
suck


On a <13 account:

> print(game:GetService("Chat"):FilterStringForPlayerAsync("suck", player))
####


Now all we have to check if the filtered string contains #'s. For that, we can use string.match. string.match returns nil if it can't find a matching substring. eg:

> print(("suck"):match("#"))
nil
> print(("####"):match("#"))
#


Wrap this in a function, make it return true if string.match returns something and false otherwise, and you've got a re-implementation of GetUnder13!

function GetUnder13(player)
return (game:GetService("Chat"):FilterStringForPlayerAsync("suck", player)):match("#") and true or false
end


Tested, and this should return false for a 13+ account and true for a <13 account.

0
Oh, and test this in a real Roblox server from a server-side script, otherwise FilterStringForPlayerAsync will not work. XAXA 1569 — 6y