generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: needing help with this script

Previous Thread :: Next Thread 
Robloxinaterr is not online. Robloxinaterr
Joined: 26 Jul 2014
Total Posts: 14824
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 is not online. fun4nerd
Joined: 30 Oct 2013
Total Posts: 4440
15 Mar 2017 07:50 PM
Tell the part parents til you reach workspace.


Report Abuse
Robloxinaterr is not online. Robloxinaterr
Joined: 26 Jul 2014
Total Posts: 14824
15 Mar 2017 08:08 PM
i don't understand what your saying
Report Abuse
fun4nerd is not online. fun4nerd
Joined: 30 Oct 2013
Total Posts: 4440
15 Mar 2017 08:10 PM
Workspace>ThingPArt>Script




Report Abuse
fun4nerd is not online. 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
Robloxinaterr is not online. Robloxinaterr
Joined: 26 Jul 2014
Total Posts: 14824
15 Mar 2017 08:23 PM
can someone help me and write a gamepass check
Report Abuse
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
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
Robloxinaterr is not online. Robloxinaterr
Joined: 26 Jul 2014
Total Posts: 14824
15 Mar 2017 08:34 PM
yes, you read my mind
Report Abuse
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
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
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
15 Mar 2017 08:43 PM
http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService/PlayerOwnsAsset


Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
15 Mar 2017 08:44 PM
Also, I don't even know why you're calling PlayerHasPass() locally to begin with.


Report Abuse
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
15 Mar 2017 08:44 PM
Or you can use MarkplaceService and use PlayerOwnsAsset either one lol.
Report Abuse
Robloxinaterr is not online. Robloxinaterr
Joined: 26 Jul 2014
Total Posts: 14824
15 Mar 2017 08:45 PM
thank u, saved my life nexus
Report Abuse
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
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
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
15 Mar 2017 08:49 PM
@fun4nerd Doesnt know what he is talking about he is just a troll.
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
15 Mar 2017 08:49 PM
No he's not a troll, he's legitimately incompetent


Report Abuse
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
15 Mar 2017 08:50 PM
You're not wrong.
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
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
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
15 Mar 2017 08:52 PM
Yeah i did know that i didnt think of PlayerOwnsAsset im stupid.
Report Abuse
Robloxinaterr is not online. Robloxinaterr
Joined: 26 Jul 2014
Total Posts: 14824
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
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
15 Mar 2017 08:53 PM
No


Report Abuse
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
15 Mar 2017 08:54 PM
Change
Report Abuse
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
15 Mar 2017 08:54 PM
It's wrong because i messed up lol.
Report Abuse
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
15 Mar 2017 08:57 PM
Change ("GamepassService") to ("MarketplaceService") and PlayerOwnsPass to PlayerOwnsAsset.
Report Abuse
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
15 Mar 2017 09:03 PM
Also change local (gamepass id) to local = (what ever gamepass id)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image