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

How do you make a player receive an item, after they clicked a part?

Asked by 4 years ago
Edited 4 years ago

So, im making an assassin game, and i have part that whenever someone clicks it they can purchase a t shirt. My problem is i want them to receive this; https://www.roblox.com/catalog/1340206957/Black-Hole-Sword when they click the part and buy my t shirt. So my question is, what script do i use for that to happen?

heres what im trying to make: https://www.roblox.com/catalog/4864121104/Crystal-Blade-Bundle

in that game, if a player buys that shirt, they receive that bundle in the game.

The part I have already has a click detector, I want players to click the part and buy my T-shirt. Once they buy my shirt, I want them to receive a Knife bundle that I made.

2 answers

Log in to vote
0
Answered by 4 years ago

To do it you will need a CLICK DETECTOR And the code this is the script that you will need to put in the block

local CLICK_BLOCK = script.Parent local ITEM_ID = 1340206957 --ID number of shirt

local Click = Instance.new("ClickDetector",CLICK_BLOCK)

Click.MouseClick:connect(function(p) game:GetService("MarketplaceService"):PromptPurchase(p,ITEM_ID) end)

But if you are doing pants then you will need this script

local CLICK_BLOCK = script.Parent local ITEM_ID = --ID Number of pant

local Click = Instance.new("ClickDetector",CLICK_BLOCK)

Click.MouseClick:connect(function(p) game:GetService("MarketplaceService"):PromptPurchase(p,ITEM_ID) end)

Ad
Log in to vote
0
Answered by 4 years ago

Use a ClickDetector, If you don't know how to use it then know how to here.

0
Make sure it's using a server script too. Tools tend to not work properly when given by a local script FrankyLovesGames 35 — 4y

Answer this question