local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local PlayerOwnsAsset = MarketplaceService.PlayerOwnsAsset
local x = Instance.new("IntValue")
x.Value = 0
local y = Instance.new("IntValue")
y.Value = 0
local boyitems = {boy1, boy2, boy3, boy4, boy5, boy6, boy7, boy8, boy9, boy10, boy11, boy12, boy13, boy14, boy15, boy16, boy17,
boy18, boy19, boy20, boy21, boy22, boy23, boy24, boy25, boy26, boy27, boy28, boy29, boy30, boy31, boy32}
local girlitems = {girl1, girl2, girl3, girl4, girl5, girl6, girl7, girl8, girl9, girl10, girl11, girl12, girl13, girl14, girl15, girl16, girl17,
girl18, girl19, girl20, girl21, girl22, girl23, girl24, girl25, girl26, girl27, girl29, girl30, girl31, girl32}
for i = 1, #boyitems, 1 do
Players.PlayerAdded:Connect(function (player)
local success, doesPlayerOwnAsset = pcall(PlayerOwnsAsset, MarketplaceService, player, boyitems[i])
if doesPlayerOwnAsset then
x.Value = x.Value + 1
print("boy", x.Value)
wait(0.1)
end
end)
end
print("stillrunning")
for i = 1, #girlitems, 1 do
Players.PlayerAdded:Connect(function (player)
local success, doesPlayerOwnAsset = pcall(PlayerOwnsAsset, MarketplaceService, player, girlitems[i])
if doesPlayerOwnAsset then
y.Value = y.Value + 1
print("girl", y.Value)
wait(0.1)
end
end)
end
print("stillrunning")
wait(30)
if (x.Value>y.Value) then
print("boy")
elseif (y.Value>x.Value) then
print("girl")
else
print("neutral")
end
wait(0.0001)
x.Value = 0
y.Value = 0
Hey! I have two questions about my script. So at the end of my script it's supposed to print "boy" "girl" or "neutral" depending on how many starter items they have that are associated with those genders. It does do this - however, when another player joins, it does not print again, it only prints for the first person. My second question is is it possible for me to pcall the entire array instead of going one by one? I'm not very familiar with how that works so any help is appreciated. Thanks!
Also disclaimer - I know Roblox is iffy about players trying to detect gender but I do not plan to publish this script, this is simply something I'm doing for fun.
