Free Shirt Reward in my game

Hi

Can anyone say me how can I make a free avatar item in my game I need to upload my game tomorrow and all player that joins they need to get a free shirt how can I make this

(Pls step step tut)

10 Likes

I think you can do it by uploading the shirt to the avatar store for free, and load the thing for them to buy it but they will get it for free if they want to. the only problem is that they can get it without joining the game.
Idk how to make a step by step tutorial because Idk how it works but this might help:

3 Likes

Create a ServerScript inside ServerScriptService.

Use the documentation @12312ababc has sent and setup a script similar to this:

local mps = game:GetService("MarketplaceService")
local shirtID = -- ID of your shirt

game.Players.PlayerAdded:Connect(function(plr)
    mps:PromptPurchase(plr, shirtID)
end

Obviously, make sure to make the shirt free. Rmember that they will get this purchase prompted at the beginning of joining the game. If you want it to prompt them automatically at a later point in time or via button, you will have to create a LocalScript inside the button for example. Create a RemoteEvent inside ReplicatedStorage and as soon as the button gets clicked, have that ButtonClick listened to by the LocalScript and fire the RemoteEvent.

For example.
LocalScript:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("RemoteEvent") -- Replace "RemoteEvent" with the name of the RemoteEvent instance you want to use

local button = script.Parent -- if the LocalScript is the child of the button used to offer the free shirt

button.MouseButton1Click:Connect(function()
    event:FireServer()
end

ServerScript, preferable called “RemoteHandler” or so:

local ReplicatedStorage = game:GetService("RrplicatedStorage")
local mps = game:GetService("MarketplaceService")

local event = ReplicatedStorage:WaitForChild("RemoteEvent") -- replace "RmeoteEvent" again with the name of your RemoteEvent in ReplicatedStorage

local shirtID = -- ID od your shirt

event.OnServerEvent:Connect(function(plr)
    -- player parameter is automatically passed
    mps:PromptPurchase(plr, shirtID)
end
4 Likes

Unless you have UGC access, note that you cannot upload free avatar items. Classic Shirts, Pants and T-Shirts (the ones a regular user can upload) have to be sold for a minimum of 5 Robux, sadly.

If you are fine with that, use @kwkxbxkdkdjjd’s response.

1 Like

When you say UGC access, does that mean that classic shirts, t shirts, and shirts can be sold for free?

1 Like

Oh righty I avsolutely forgot that, the code should still work tho. Thanks for adding more information to it!

1 Like

No. I mean that people with UGC access can make free LimitedU items (hats… etc.) and set them for free. They do have to pay for each copy that can be obtained. Shirts, pants and etc still have to be sold for a minimum of 5 Robux.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.