Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why does this script say that i dont own the product even if i own the product?

function print()
	local player = game.Players:FindFirstChild(script.Parent.CurrentPlayer.Value)
	if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 555) or game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 5555) or game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 5755) then
print("Player Has A Product")
else
print("Player Does Not Have A Product")
end
wait(3)
print()

it will say that the player does not own the product even if the player owns the product. please help. random ids given

3 comments

0

Are you testing in Studio? Are you logged in properly?

0

yes

0

i tested it on roblox player not studio

1 answer

✓ Accepted answer

Something is probably wrong with your 'player' variable or you have the wrong asset Id's. This worked for me, so that's my best deduction. Also, don't name anything after functions ROBLOX uses internally, like print().

local market = game:GetService('MarketplaceService')

local assets = {
	607700713;
	727371002;
	55;
}

local function doesPlayerOwn(player)
	for i,v in pairs(assets) do 
		if market:PlayerOwnsAsset(player, v) then 
			return true
		end
	end
	return false
end

game.Players.PlayerAdded:connect(function(player)	
	if doesPlayerOwn(player) then 
		print("Player Has A Product")
	else
		print("Player Does Not Have A Product")
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.