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

How to I authenticate a game pass properly?

Asked by
Ripull 45
10 years ago

I have only started using them today, and I can't seem to get them to work. Do they only work in the place that they are uploaded to? I keep getting a false return on my Authentication function. I understand the method, it's quite simple actually. I'm just having trouble Authenticating the passes. I'm testing the passes in a game separate to the one I uploaded them to.

passId = 152822032 

function isAuthenticated(player) 
return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

--[[stuff & variables]]--

--PTS is the localplayer

if PTS.TeamColor ~= BrickColor.new("Bright red")then
PTS.leaderstats.Points.Value = PTS.leaderstats.Points.Value +1
PTS.TestPoints.Value = PTS.TestPoints.Value +1
if isAuthenticated(PTS) then --Aunthenticate function which ALWAYS return false
PTS.leaderstats.Points.Value = PTS.leaderstats.Points.Value +1
PTS.TestPoints.Value = PTS.TestPoints.Value +1
end

--[[more stuff]]--

1 answer

Log in to vote
0
Answered by
AxeOfMen 434 Moderation Voter
10 years ago

The PlayerHasPass function is not limited to the place the game pass was created for. It will return the correct value from any place.

I noticed that your call to isAuthenticated only occurs if the color of the player's team is not Bright red. Is that intentional? Your code is missing an end. It is impossible for me to know the intent of your code, but it looks as though it belongs between lines 13 and 14. Proper indentation of your code would highlight this problem.

Perhaps your code should be...

passId = 152822032 

function isAuthenticated(player) 
    return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

--[[stuff & variables]]--

--PTS is the localplayer

if PTS.TeamColor ~= BrickColor.new("Bright red")then
    PTS.leaderstats.Points.Value = PTS.leaderstats.Points.Value +1
    PTS.TestPoints.Value = PTS.TestPoints.Value +1
end
if isAuthenticated(PTS) then
    PTS.leaderstats.Points.Value = PTS.leaderstats.Points.Value +1
    PTS.TestPoints.Value = PTS.TestPoints.Value +1
end

--[[more stuff]]--
Ad

Answer this question