I am developing a government roleplay game. I’d like to prevent <13 players from engaging with certain features (i.e. political offices) to prevent them from harming the experience for older users, without excluding them from the game entirely.
Is there a solution for accomplishing this? Even if it’s not 100% accurate, could I use something like AllowedExternalLinkReferences as a rough estimate of a player’s age? Is this permissible under Roblox guidelines?
i got the answer from gpt i will just paste it here
Yes, you can determine if a player is 13+ or under 13 in Roblox Studio using the PolicyService or VoiceChatService. Here are two methods you can use:
Using PolicyService:
The PolicyService:GetPolicyInfoForPlayerAsync() function can help you determine if certain features are allowed for the player. For example, ads are only shown to players who are 13+.
local PolicyService = game:GetService("PolicyService")
game.Players.PlayerAdded:Connect(function(player)
local success, policyInfo = pcall(function()
return PolicyService:GetPolicyInfoForPlayerAsync(player)
end)
if success then
if policyInfo.AreAdsAllowed then
print(player.Name .. " is 13+")
else
print(player.Name .. " is under 13")
end
else
warn("Failed to get policy info for " .. player.Name)
end
end)
Using VoiceChatService:
The VoiceChatService:IsVoiceEnabledForUserIdAsync() function can be used since voice chat is only available for players who are 13+.
local VoiceChatService = game:GetService("VoiceChatService")
game.Players.PlayerAdded:Connect(function(player)
local success, isVoiceEnabled = pcall(function()
return VoiceChatService:IsVoiceEnabledForUserIdAsync(player.UserId)
end)
if success then
if isVoiceEnabled then
print(player.Name .. " is 13+")
else
print(player.Name .. " is under 13")
end
else
warn("Failed to check voice chat status for " .. player.Name)
end
end)