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

Why is this game pass script not working?

Asked by 9 years ago

This game pass script is not working, and I have no idea why. It is supposed to give a player that owns the game pass a weapon.

Can someone please help me?

Here's the script:

01local passId = 320562253
02 
03function authenticate(player)
04return game:GetService("GamePassService"):PlayerHasPass(player, passId)
05end
06 
07 
08function Enter(plr)
09wait(0.5)
10if authenticate(plr) then
11local c = plr.M1014
12c.Value = true
13end
14end
15game.Players.ChildAdded:connect(Enter)

1 answer

Log in to vote
1
Answered by
GShocked 150
9 years ago

I believe authenticate(player) returns a bool value (meaning true or false). So your if statement basically checks if the returned value of authenticate(palyer) is not nil, not if it is true or false. So here should be the fixed code:

01local passId = 320562253
02 
03function authenticate(player)
04return game:GetService("GamePassService"):PlayerHasPass(player, passId)
05end
06 
07 
08function Enter(plr)
09wait(0.5)
10if authenticate(plr) == true then
11local c = plr.M1014
12c.Value = true
13end
14end
15game.Players.ChildAdded:connect(Enter)
0
It works, thanks! CoolJohnnyboy 121 — 9y
Ad

Answer this question