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

Issues with PlayerOwnsAsset not working?

Okay, so I am making a SCI (self check-in) and I want to check if a user owns a t-shirt, here's the code I got

local MarketplaceService = game:GetService("MarketplaceService")
local LocalPlayer = game.Players.LocalPlayer

local Asset = 4467639060

local function OnPlayeEntered(LocalPlayer)
	if MarketplaceService:LocalPlayerOwnsAsset(LocalPlayer, Asset) then
		print(LocalPlayer.Name .. " owns t-shirt")
	else
		warn(LocalPlayer.Name .. " does not own t-shirt")
	end
end

When I playtest, I get nothing in console, no print, no errors, no nothing. NOTE: My inventory is public the second run, and still nothing.

1 answer

✓ Accepted answer
local MarketplaceService = game:GetService("MarketplaceService")
local LocalPlayer = game.Players.LocalPlayer

local Asset = 4467639060

local function OnPlayeEntered()
    if MarketplaceService:PlayerOwnsAsset(LocalPlayer, Asset) then
        print(LocalPlayer.Name .. " owns t-shirt")
    else
        warn(LocalPlayer.Name .. " does not own t-shirt")
    end
end

game.Players.PlayerAdded:Connect(function(plr)
	if plr == LocalPlayer then
		OnPlayeEntered()
	end
end

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