I want to make a script that gives people tools who have bought the t-shirt. [I'm newbie at scripting]
Can anyone help me?
I want to make a script that gives people tools who have bought the t-shirt. [I'm newbie at scripting]
Can anyone help me?
Use the PlayerOwnsAsset method of MarketPlaceService.
local Tools = Workspace.TShirtTools -- you can change this
local assetId = 0 -- change this to the id of your shirt
game.Players.PlayerAdded:connect(function(player) -- when a player enters
player.CharacterAdded:connect(function() --this will fire when their character is added
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, assetId) then --if they own the t-shirt, then
for i,v in next, Tools:GetChildren() do -- loop through the t-shirt tools
local clone = v:Clone()
clone.Parent = player.Backpack -- clone the tool(s) into their backpack
end
end
end)
end)
Wiki Page: > http://wiki.roblox.com/index.php?title=PlayerOwnsAsset_(Method)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Learn to print text to the Output Window, discover the wonderfully annoying world of AssetIDs, then come back and we'll talk.