Baya
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 12044 |
|
|
| 31 Oct 2016 02:28 PM |
local ID = 516086074 script.Parent.Touched:connect(function() game:GetService("MarketplaceService"):PromptPurchase(ITEM_ID) end)
|
|
|
| Report Abuse |
|
|
| |
|
Baya
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 12044 |
|
|
| 31 Oct 2016 02:47 PM |
I don't see anything which is amusing.
|
|
|
| Report Abuse |
|
|
|
| 31 Oct 2016 02:51 PM |
You have to give the player as the first argument.
You can get the player by using the :GetPlayerFromCharacter method on Players, giving the parent of the part that touched the scripts parent.
Also, you may want to check to see if the player already owns the item before prompting them to purchase it.
local MarketplaceService = game:GetService("MarketplaceService")
local Id = 516086074
script.Parent.Touched:connect(function(Hit) local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent) if Player and not MarketplaceService:PlayerOwnsAsset(Player, Id) then MarketplaceService:PromptPurchase(Player, Id) end end)
|
|
|
| Report Abuse |
|
|
|
| 31 Oct 2016 02:51 PM |
it does not know who to prompt it to
|
|
|
| Report Abuse |
|
|
|
| 31 Oct 2016 02:52 PM |
local ID = 516086074
script.Parent.Touched:connect(function(hit) if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) game:GetService("MarketplaceService"):PromptPurchase(player,ID) end end)
^ that should work
|
|
|
| Report Abuse |
|
|
Baya
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 12044 |
|
|
| 31 Oct 2016 02:54 PM |
More confusing than I thought it would be, thanks guys appreciated a lot!
Apart from the first guy.
|
|
|
| Report Abuse |
|
|
|
| 31 Oct 2016 02:54 PM |
lol when this is 'complicated'
|
|
|
| Report Abuse |
|
|
Crimsonal
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1795 |
|
|
| 31 Oct 2016 03:44 PM |
> local ID = 516086074 > game:GetService("MarketplaceService"):PromptPurchase(ITEM_ID)
> ITEM_ID > ID uhhhhhhhhhhh,,,,,,,,,,,,,, |
|
|
| Report Abuse |
|
|
Crimsonal
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1795 |
|
|
| 31 Oct 2016 03:47 PM |
btw PromptPurchase() uses the playerId as the first argument and the ItemId as the second
MarketplaceService:PromptPurchase(PLAYER_ID, ITEM_ID); |
|
|
| Report Abuse |
|
|