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

Script not showing button when player owns gamepass?

Asked by 7 years ago
Edited 7 years ago

I am trying to get a button to show if a player has the gamepass but it's not working.

local id = 1308026475

game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then
    script.Parent.Visible = true
    end
end)

Please help! Thanks in advance.

1
This is in a server script, right? Conquesias 85 — 7y
0
No it's a local script. lce_bear 31 — 7y

2 answers

Log in to vote
1
Answered by 7 years ago

Use a script instead of a localscript if your using a local script.

Ad
Log in to vote
0
Answered by 7 years ago

Make sure it's in a server script like FireyMcBlox said. If it is, I suggest adding to the script a bit.

local id = 1308026475

game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then
     script.Parent.Visible = true
else
    script.Parent.Visible = false
    end
end)
0
The button is still not showing. lce_bear 31 — 7y
0
Does it say anything in the output? Conquesias 85 — 7y
0
Okay, so I looked up your gamepass and it's most likely because it isn't for sale. Conquesias 85 — 7y
0
No lce_bear 31 — 7y
View all comments (4 more)
0
I tried using another id from a gamepass that is on sale, because the one I originally wanted to use is not complete yet, but the button still isn't showing. lce_bear 31 — 7y
0
Have you converted it to the server script yet? Conquesias 85 — 7y
0
Yes. I got it to work by rewriting the whole thing but thanks anyways! lce_bear 31 — 7y
0
Mhm... Conquesias 85 — 7y

Answer this question