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

This gamepass activation is'nt working. Any ideas?

So basically I have a gamepass which when you buy it turns a boolean on. But that isnt working. I probed the script, tested some on servers and came to the conclusion that the boolean is'nt changing. But, the console shows no errors.

Thanks, -RadioactiveSherbet

	local passid = 440638589 -- Gamepass ID
local GamePassService = game:GetService("GamePassService")
game.Players.PlayerAdded:connect(function(player)
if GamePassService:PlayerHasPass(player, passid) then
	player.CGPH.Value = true
end
end)
	

Please downvote if you thought it through, and it would be nice to upvote

1 answer

✓ Accepted answer
local GamepassId = 440638589 -- 	The gamepass ID we will be using
local GamepassService = game:GetService("GamePassService")
game.Players.PlayerAdded:connect(function(plr)
		if GamepassService:PlayerHasPass(plr, GamepassId) then
			print(plr.Name.." Has pass ("..GamepassId..")!") -- Just a print function that tells us that the player has the pass
			-- The line it has to do
		end
end)

Note: I haven't tested this yet, it may not work. Sorry if it doesn't work :D

Edit

The ROBLOX Wiki has a API page for GamepassService, just look there if you need any help

3 comments

0

It still didnt work

0

@RadioactiveSherbert, have you checked the Developer Console (Check both Server and Local Logs tabs) or Output to indicate if there are any errors. What environment are you testing this in (Studio Play Solo, Studio Test Server, Online Mode)?

0

Online mode because gamepass queries dont work in Studio @M39a9am3R

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