Adding donations (Basic)

This tutorial will tell you how you can add donations.

by GamersInternational

Author Avatar

Introduction

Donations are an easy and fast way to earn some money from your game. Today I will teach you how you can add donations.

Step 1: Create a developer product

Your game must be published to Roblox to do this step and this needs to be done on a PC/Mac.

A developer product is how you can accept donations. First, go to your game page and click the three dots in top right corner, then click Configure this Place. Now go into the section named 'Developer Products'. Create a new developer product and fill out the required boxes and choose an image if you want. After click create, once your back to the main screen make sure to copy the ID as you'll need it later. Make as many of these as needed, for every donation repeat step 2 and step 2.1, also make sure that you make sure each name for the ScreenGUI is different.

Step 2: Edit your game

You must be on a PC/Mac to do this step as you need to edit your game in Roblox Studio.

Launch your game so you can edit and then make sure the Explorer window is open (you can check if it's open by going into the VIEW tab near the top of your screen). You need to then scroll down to StarterGUI and make a new ScreenGUI in the folder. Give your ScreenGUI an easy to remember name like 'DonationGUI'. You need to then create a new TextButton in the folder. It's best to customise your text button, make sure it's not in a place that may disrupt gameplay and make sure it's not too big. Also give the text inside the button a name such as 'Donate'.

Step 2.1: Scripting the button

You now need to insert a LocalScript (it can't be a standard Script or a ModuleScript) to your DonationGUI (make sure to add it to the ScreenGUI not the button). Now this is where the coding for your button will happen! Replace the default text with the following:

local id = InsertDeveloperProductIDHere

script.Parent.TextButton.MouseButton1Click:connect(function()
    game.MarketplaceService:PromptProductPurchase(script.Parent.Parent.Parent, id)
end)

Make sure to replace InsertDeveloperProductIDHere with the ID you copied back in Step 1.

You've now made your own donation button!

Step 2.2: Testing your buttons

You've completed the tutorial but you need to check that your buttons are working correctly. To do this, make sure the tabs at the top of your screen is on the 'HOME' tab. You then need to click the Play button. Your game should now load in Studio. Now click your donation button, there should be a pop-up come up, it should look like this (if the decal doesn't show, it's basically a pop-up asking if you want to buy the developer product, as your testing if you try to buy it you won't be charged):

img|25x20

Step 3: You've created your donation button

Congratulations! You've passed my adding donations (basic) tutorials. As this suggests, this is a basic tutorial however this should be useful for people adding 1 donation button. Please make sure to leave a positive review if this helped you!

View in-game to comment, award, and more!