I am making a system that kicks a player if they own a certain asset. I made a post yesterday and got smart people to help me get it working. Now ive ran into another problem. I cant add more then 1 asset ID. Heres my code:
local AssetId = 5972800229, 31117267
game.Players.PlayerAdded:Connect(function(player)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,AssetId) then
player:Kick("I told you")
end
end)
local AssetIds = {5972800229, 31117267}
game.Players.PlayerAdded:Connect(function(player)
for i,v in pairs(AssetIds) do
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,v) then
player:Kick("I told you")
end
end
end)
local assets = {
5972800229,
31117267
}
game.Players.PlayerAdded:Connect(function(player)
for i = 1, #assets, 1 do
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, assets[i]) then
player:Kick("you own a bad asset or somethign")
end
end
end)
that wont even work, youre just checking if they own the asset id “1” and “2” with this for loop. to do it this way you would have to use assets[i], not just i.
FYI the reason your original one didn’t work is because you have to run an individual check for each asset in the table; you can’t pass the table to PlayerOwnsAsset.