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: checking when a player has a gamepass and then execute code

Previous Thread :: Next Thread 
isc88 is not online. isc88
Joined: 30 May 2013
Total Posts: 27545
21 Jun 2015 08:51 PM
I need it to check if the player has this gamepass
http://www.roblox.com/Earbuds-item?id=261180742
and if the player has the gamepass execute this code


script.Parent.Frame.Visible = true
local sound = Instance.new("Sound",script.Parent)
sound.Volume=1
sound.Pitch=1
sound.Name="sound"
sound.Looped=true
sound.PlayOnRemove=false
local player = game.Players.LocalPlayer
local Format = "http://www.roblox.com/asset/?id=##ID##"
local frame = script.Parent:WaitForChild("Frame")

frame:WaitForChild("Play").MouseButton1Click:connect(function()
local input = tonumber(frame:WaitForChild("Input").Text)
if input then
sound:Stop()
sound.SoundId=Format:gsub("##ID##", tostring(input))
sound:Play()
end
end)
frame:WaitForChild("Stop").MouseButton1Click:connect(function()
sound:Stop()
end)



I can't find anything on this that works

what siggy
Report Abuse
isc88 is not online. isc88
Joined: 30 May 2013
Total Posts: 27545
21 Jun 2015 08:58 PM
;-;


what siggy
Report Abuse
isc88 is not online. isc88
Joined: 30 May 2013
Total Posts: 27545
21 Jun 2015 09:06 PM
heeelpp


what siggy
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
21 Jun 2015 09:08 PM
PlayerOwnsAsset
Report Abuse
isc88 is not online. isc88
Joined: 30 May 2013
Total Posts: 27545
21 Jun 2015 09:33 PM
kkkkkkk


what siggy
Report Abuse
K7Q is not online. K7Q
Joined: 23 Mar 2013
Total Posts: 5546
21 Jun 2015 09:40 PM
game.Players.PlayerAdded:connect(function(player)
passId = PASS ID
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId) then
(YOUR CODE)
Report Abuse
isc88 is not online. isc88
Joined: 30 May 2013
Total Posts: 27545
21 Jun 2015 09:52 PM
it's not working..


what siggy
Report Abuse
vacha is not online. vacha
Joined: 06 Jan 2011
Total Posts: 1993
21 Jun 2015 09:56 PM
local mps = game:GetService("MarketplaceService")
local assetid = 66666666
game.Players.PlayerAdded:connect(function(player)
if mps:PlayerOwnsAsset(assetid,player) then
print'Player Owns the asset!'
else
print'Player doesn't own the asset I should prompt them to buy it
--Code
end
end)

That is if you wanted to check if they own the pass every time a player enters your game. If not you can remove the last line and Line3 and incorporate it into any block
while true do the do
Report Abuse
vacha is not online. vacha
Joined: 06 Jan 2011
Total Posts: 1993
21 Jun 2015 09:57 PM
if mps:PlayerOwnsAsset(player,assetid) then --the player instance is the first argument
Replace line 4 with that ^^

while true do the do
Report Abuse
isc88 is not online. isc88
Joined: 30 May 2013
Total Posts: 27545
22 Jun 2015 10:36 AM
it STILL doesn't work ;-;
it's in a localscript



what siggy
Report Abuse
vacha is not online. vacha
Joined: 06 Jan 2011
Total Posts: 1993
22 Jun 2015 02:05 PM
put it in a server script

while true do the do
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