|
| 15 Mar 2017 07:48 PM |
well i'm needing help on adding it so you get the gun for free only if you have the gamepass, and if you don't have it then it'll pull up a prompt to buy it
Credits = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Credits
function onClick() if Credits.Value >= 0 then Credits.Value = Credits.Value - 0 local RockLaunch = game.Lighting.GUN:clone() RockLaunch.Parent = script.Parent.Parent.Parent.Parent.Parent.StarterGear local RockLaunch = game.Lighting.GUN:clone() RockLaunch.Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack RockLaunch.Handle.Anchored = false end end
script.Parent.MouseButton1Click:connect(onClick)
WHAT SHOULD i add the check for the gamepass? |
|
|
| Report Abuse |
|
|
fun4nerd
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 4440 |
|
|
| 15 Mar 2017 07:50 PM |
Tell the part parents til you reach workspace.
|
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:08 PM |
| i don't understand what your saying |
|
|
| Report Abuse |
|
|
fun4nerd
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 4440 |
|
|
| 15 Mar 2017 08:10 PM |
Workspace>ThingPArt>Script
|
|
|
| Report Abuse |
|
|
fun4nerd
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 4440 |
|
|
| 15 Mar 2017 08:11 PM |
OOOO
Credits = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Credits.Value
|
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:23 PM |
| can someone help me and write a gamepass check |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:25 PM |
| Wait be specific so you want it so if the player has the pass then itll do all that is that what you want. |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 Mar 2017 08:39 PM |
Well try this: local player = game.Players.LocalPlayer local id (gamepass id) if game:GetService("GamePassService"):PlayerHasPass(player,id) then --stuff
else local id (gamepass id) game:GetService("MarketplaceService"):PromptPurchase(player, id) |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:43 PM |
http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService/PlayerOwnsAsset
|
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:44 PM |
Also, I don't even know why you're calling PlayerHasPass() locally to begin with.
|
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:44 PM |
| Or you can use MarkplaceService and use PlayerOwnsAsset either one lol. |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:45 PM |
| thank u, saved my life nexus |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:45 PM |
| He is useing a gui judgeing by "script.Parent.MouseButton1Click:connect(onClick)" so i made it local. |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:49 PM |
| @fun4nerd Doesnt know what he is talking about he is just a troll. |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:49 PM |
No he's not a troll, he's legitimately incompetent
|
|
|
| Report Abuse |
|
|
| |
|
|
| 15 Mar 2017 08:50 PM |
"He is useing a gui judgeing by "script.Parent.MouseButton1Click:connect(onClick)" so i made it local."
You didn't get the hint? PlayerHasPass() doesn't work locally.
|
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:52 PM |
| Yeah i did know that i didnt think of PlayerOwnsAsset im stupid. |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:53 PM |
so is this right?
local player = game.Players.LocalPlayer local id (gamepass id) if game:GetService("GamePassService"):PlayerHasPass(player,156239537) then
Credits = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Credits
function onClick() if Credits.Value >= 0 then Credits.Value = Credits.Value - 0 local RockLaunch = game.Lighting.GUN:clone() RockLaunch.Parent = script.Parent.Parent.Parent.Parent.Parent.StarterGear local RockLaunch = game.Lighting.GUN:clone() RockLaunch.Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack RockLaunch.Handle.Anchored = false end end
script.Parent.MouseButton1Click:connect(onClick)
else local id (gamepass id) game:GetService("MarketplaceService"):PromptPurchase(player, 156239537)
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 15 Mar 2017 08:54 PM |
| It's wrong because i messed up lol. |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 08:57 PM |
| Change ("GamepassService") to ("MarketplaceService") and PlayerOwnsPass to PlayerOwnsAsset. |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2017 09:03 PM |
| Also change local (gamepass id) to local = (what ever gamepass id) |
|
|
| Report Abuse |
|
|