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

Why my script doesn't work?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Here is my script:

01function hasPass(player,id) --Creating a simple function to see if the player has the GamePass with that id
02 if game:GetService("GamePassService"):PlayerHasPass(player,id) then
03  return true
04 else
05  return false
06 end
07end
08 
09 
10 
11game.Players.PlayerAdded:connect(function(player)
12 
13 if hasPass(player,163409880) then --We're calling the function
14  print(player.Name .. " has the GamePass!")
15 
View all 23 lines...

this script suppose to give player a badge if he got the gampass

0
You don't have a connection line to run the hasPass function. Try adding a connection line. SlickPwner 534 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Your code never actually awards a badge! Also you only check if the user has the badge if they don't have the pass, Right code:

01function hasPass(player,id) --Creating a simple function to see if the player has the GamePass with that id
02 if game:GetService("GamePassService"):PlayerHasPass(player,id) then
03  return true
04 else
05  return false
06 end
07end
08 
09 
10 
11game.Players.PlayerAdded:connect(function(player)
12 
13 if hasPass(player,163409880) then --We're calling the function
14  print(player.Name .. " has the GamePass!")
15 
View all 25 lines...
0
thanks may you fixed it so ill be able to copy it? KillSide 0 — 10y
Ad

Answer this question