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