Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't my gamepass script work?

Asked by 8 years ago

Now here is my script (It is supposed to remove the ImageButton and Frame1 which is inside Frame if player doesn't have the gamepass):

id = 382406860 --Gamepass Id

plr = script.Parent.Parent.Parent.Parent
repeat wait() until plr.PlayerGui 
if not plr:PlayerHasPass(id) then
    script.Parent.Parent.Parent.Frame.Frame1:Destroy()
    wait(0.1) 
    script.Parent:Destroy()
end

I'm not sure what went wrong... Does anyone know and can help me?

1 answer

Log in to vote
1
Answered by 8 years ago

You dont use player. you use GamePassService. BUUUUTTT lets ditch this method. just DONT. players have to rejoin if you use that. Lets rewrite this with PlayerOwnsAsset.

id = 382406860 --Gamepass Id
local MarketPlace = game:GetService("MarketPlaceService") 

plr = script.Parent.Parent.Parent.Parent
repeat wait() until plr.PlayerGui 
if not MarketPlace:PlayerOwnsAsset(plr, id) then -- use Marketplace, put plr in the parenthese 
    script.Parent.Parent.Parent.Frame.Frame1:Destroy()
    wait(0.1) 
    script.Parent:Destroy()
end

Vote up if i helped! Comment back if it didnt!

0
Grammar, m8? JamesLWalker 297 — 8y
0
? bubbaman73 143 — 8y
0
It didn't work again, but there was an output error: 21:47:54.350 - 'MarketPlaceService' is not a valid Service name kelimeguy 60 — 8y
0
OH! Caps problem! MarketplaceService* bubbaman73 143 — 8y
Ad

Answer this question