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

How to check if a player has a shirt?

local shirtid = 2037398414

local players = game:GetService("Players")
local mps = game:GetService("MarketplaceService")
local shirtown = mps.PlayerOwnsAsset
 
players.PlayerAdded:Connect(function(player)
	local success, doesPlayerOwnAsset = pcall(shirtown, mps, player, shirtid)
	if doesPlayerOwnAsset then
		local shirt = workspace:FindFirstChild(player.Name):WaitForChild("Shirt")
		shirt.ShirtTemplate = "http://www.roblox.com/asset/?id="..shirtid
	else
		print("Player doesn't have shirt.")
	end
end)

All it does is make my shirt disappear

2 comments

0

Use "rbxassetid://"..shirtid. You can also immediately reference the Players affiliated avatar by calling Player.Character.

0

Doesnt work, my shirt still disappears

1 answer

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