Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

1 comment

0

Ok thank you.

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

3 comments

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.

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

0

You don't understand. If they have both it will just go twice, I don't want that to happen.

This discussion is preserved as it was. New answers, comments, and votes are closed.