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

How do you make a t shirt so when someone buys it in game, they get an item?

So i am making an Assassin game, and i want to create a shop to show all the different knifes in the game that people can buy. But i seen in a lot of groups that they have t shirts that gives someone a knife when they buy the t shirt in game. So my question is, what is the script for that to be possible in my game.

heres a link as to what im talking about : https://www.roblox.com/catalog/4868462903/Nightsky-Bundle

1 answer

✓ Accepted answer

local ASSET_ID = --put the item id here
 
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local PlayerOwnsAsset = MarketplaceService.PlayerOwnsAsset
 
Players.PlayerAdded:Connect(function (player)
	local success, doesPlayerOwnAsset = pcall(PlayerOwnsAsset, MarketplaceService, player, ASSET_ID)
	if doesPlayerOwnAsset then
		-- put grant knife skin script here
	else
		print(player.Name .. " doesn't own " .. ASSET_NAME)
	end
end)

7 comments

0

The dev-forum has a nice page for this. I used the same format ever since. For more info on how this works, check this out: https://developer.roblox.com/en-us/api-reference/function/MarketplaceService/PlayerOwnsAssetHeavenlyblobmaster 1

0

also, if you need help giving the player the knife skin, i can help with that too.

0

so what is the grant knife skin script?

0

oh

0

it depends how you are doing it

0

you can use bool values or whatever. But if you want me to like be able to understand, we could dm on discord: BlobMaster#8156

0

like when someone buys the t shirt product, they receive a knife that the t shirt was scripted to give them.

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