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

How could I make a script check TWICE for different gamepasses?

Asked by 9 years ago

I'm trying to make a button where it would check to see if you have a game pass and if you don't it will check if you have another. Could someone fix this for me?, thanks in advance.

plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
    if game:GetService("GamePassService"):PlayerHasPass(plr, 12356) then
        print("Has pass")
    else
        if game:GetService("GamePassService"):PlayerHasPass(plr, 124578) then
            print("Has Pass2")
    else
        print("Has no pass")
        end
    end
end)

2 answers

Log in to vote
0
Answered by
Legojoker 345 Moderation Voter
9 years ago

A player owning a game pass can not be checked using a local script, which I assume you are using because plr = game.Players.LocalPlayer. You will need to have a regular script check for that person's game passes and return to that script its answer for that local script to deal with it. I suggest inserting values in to each other's script for data to be transferred (such as the player's name, and when sent back the answer). Or you could make this a lot easier and just have it all in a normal script.

0
Ok thank you. GetSporked 5 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

Just make separate scripts, because both will be read at the same time. Unless, you need one pass to have another, that's different.

0
That will break it. I need to have it in the same script because I made it fire rockets if you either one of the passes. GetSporked 5 — 9y
0
In that case then, make the separate scripts for the gamepasses, and if one of them is owned, it will fire rockets. Make the separate scripts identical, just with different Gamepass ID's User#4422 0 — 9y
0
You don't understand. If they have both it will just go twice, I don't want that to happen. GetSporked 5 — 9y

Answer this question