Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

Can anyone help me with VIP T-SHIRT TOOLS?

Asked by 10 years ago

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?

0
Learn to print text to the Output Window, discover the wonderfully annoying world of AssetIDs, then come back and we'll talk. OniiCh_n 410 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

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)

Ad

Answer this question