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 » Scripting Helpers
Home Search
 

Re: Check if the player got x Gamepass

Previous Thread :: Next Thread 
skript92 is not online. skript92
Joined: 23 Jul 2013
Total Posts: 1430
18 Aug 2014 02:06 PM
How can you do that?

Gimme Posts :D
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
18 Aug 2014 02:08 PM
GamePassService.

http://wiki.roblox.com/index.php?title=API:Class/GamePassService
http://wiki.roblox.com/index.php?title=API:Class/GamePassService/PlayerHasPass

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
skript92 is not online. skript92
Joined: 23 Jul 2013
Total Posts: 1430
18 Aug 2014 02:08 PM
You again xD

Gimme Posts :D
Report Abuse
skript92 is not online. skript92
Joined: 23 Jul 2013
Total Posts: 1430
18 Aug 2014 02:17 PM
if game:GetService(GamePassService):PlayerHasPass(player,id) then

21:16:42.336 - Argument 1 missing or nil

Gimme Posts :D
Report Abuse
skript92 is not online. skript92
Joined: 23 Jul 2013
Total Posts: 1430
18 Aug 2014 02:20 PM
Helpz blease.

Gimme Posts :D
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
18 Aug 2014 02:22 PM
That means that you never set the "player" variable. Would you care to post your entire script?

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
skript92 is not online. skript92
Joined: 23 Jul 2013
Total Posts: 1430
18 Aug 2014 02:24 PM
player = game.Players.LocalPlayer
char = player.Character
m = player:GetMouse()
id = 153633139 -- Put your gamepass ID, (the last numbers)
-- Put za tool in ServerStorage


m.KeyDown:connect(function(key)
if key:lower() == "q" then
for i,v in pairs (game.ServerStorage:GetChildren()) do
if game:GetService(GamePassService):PlayerHasPassid(player,id) then
if v:IsA("Tool") then
clone = v:clone()
clone.Parent = game.Workspace
clone.Handle.CFrame = char.Torso.CFrame+Vector3.new(5,1,math.random(1,3))
script.Disabled = true
end
else
print(player.Name.." Tried to use a gamepass feautre but he doesn't own it.")
end
end
end
end)

Gimme Posts :D
Report Abuse
skript92 is not online. skript92
Joined: 23 Jul 2013
Total Posts: 1430
18 Aug 2014 02:27 PM
sooo....
Gimme Posts :D
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
18 Aug 2014 02:30 PM
You can also use:

game:GetService("MarketplaceService"):PlayerOwnsAsset(Player, ID)
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
18 Aug 2014 02:32 PM
LocalPlayer can only be used from LocalScripts. Provided you are using one, you cannot access ServerStorage (and I'm pretty sure GamePassService won't work). If you're not, you can't use LocalPlayer. Other than that, your script should work fine?

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
skript92 is not online. skript92
Joined: 23 Jul 2013
Total Posts: 1430
18 Aug 2014 02:37 PM
game:GetService("MarketplaceService"):PlayerOwnsAsset(Player, ID)
WORKS!

Gimme Posts :D
Report Abuse
skript92 is not online. skript92
Joined: 23 Jul 2013
Total Posts: 1430
18 Aug 2014 02:54 PM
server storage isn't a valid member of DataModel
D:
Gimme Posts :D
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
18 Aug 2014 02:55 PM
That means that you are using a LocalScript. ServerStorage is called ServerStorage for a reason; it is for the server, and is not replicated to the client. In other words, LocalScripts can't use it. Try a Script.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
18 Aug 2014 05:21 PM
Move items into ReplicatedStorage. Then Local scripts and Server scripts can get to them.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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