Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

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

Asked by 8 years ago

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.

Why was this question closed?

2 answers

Log in to vote
10
Answered by
XAXA 1569 Moderation Voter
8 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 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

This is not possible, you can only get the in-game age of a player, This is only the account age . You can't get the age of a roblox player due to security reasons

0
then i will make my game ask for username and password and then make an api request to view age huehuehue iipooplord 15 — 8y
2
Let the flagging for potentially malicious script begin. You can not request users to provide a username and password. That is against ROBLOX's Terms of Service. Anyways, people can lie about their age it's not that hard. M39a9am3R 3210 — 8y