|
| 06 Feb 2017 05:25 PM |
| Hi, I need some help. I'm trying to build a game pass that gives people tea and a bowl of rice when they join the game. Only thing is, I can't figure out how. I know how to do it with regular gear from the catalog, but I cannot figure out how to do a custom gear? |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 06 Feb 2017 05:29 PM |
local rice = 12341234 -- rice gamepass ID local tea = 12341234 -- tea gamepass ID local ms = ame:GetService("MarketplaceService")
game.Players.PlayerAdded:connect(function(player) if ms:PlayerOwnsAsset(player,rice) then game.ServerStorage:FindFirstChild("RiceTool"):Clone().Parent = player.StarterGear game.ServerStorage:FindFirstChild("RiceTool"):Clone().Parent = player.Backpack end if ms:PlayerOwnsAsset(player,tea) then game.ServerStorage:FindFirstChild("TeaTool"):Clone().Parent = player.StarterGear game.ServerStorage:FindFirstChild("TeaTool"):Clone().Parent = player.Backpack end end)
-- Probably a way to optimize this redundancy, however, you'll need to put it in both the player's startergear and backpack so that they get it on subsequent respawns
|
|
|
| Report Abuse |
|
|
|
| 06 Feb 2017 05:34 PM |
| Alright, thank you very much. |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2017 05:39 PM |
| One more question, the gear I'm using (they're models), I don't have a gear id for them. So what do I do? |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 06 Feb 2017 05:41 PM |
Those would be the gamepass IDs, not the gear IDs Just put the tools in the ServerStorage
|
|
|
| Report Abuse |
|
|
|
| 06 Feb 2017 05:45 PM |
| Alright so I put the gear in server storage, and now all I have to do is put the gamepass id into the script? How will it know I want THOSE tools??? |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2017 05:46 PM |
'game.ServerStorage:FindFirstChild("RiceTool")' .. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 06 Feb 2017 05:47 PM |
Because I named them RiceTool and TeaTool, which you should name your tools accordingly, and then put them in the ServerScriptService.
If you need to insert them into your game first, use this: http://wiki.roblox.com/index.php?title=API:Class/InsertService/LoadAsset
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 06 Feb 2017 05:47 PM |
Do away with FindFirstChild if it triggers you because it's unnecessary but was just as easy to copypasta
|
|
|
| Report Abuse |
|
|
|
| 06 Feb 2017 05:55 PM |
Darnit. I cannot seem to make it work!! I put the 2 items in service storage, and sever script service. Is it possible that you could make a script with the gamepass, tea, and rice id and then turn it into a model and send it to me? I know its a lot to ask but none of this is working for me >.<
This is the gamepass: https://www.roblox.com/library/643885738/Tea-and-a-bowl-of-rice
The rice is at: https://www.roblox.com/library/274906395/Bowl-of-Rice
The tea is at: https://www.roblox.com/library/164620253/Tea |
|
|
| Report Abuse |
|
|