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

Why This script doesn't work?

Asked by 10 years ago

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 26 lines...

it suppose to give badge when player has gamepass.

please help me to fix it, thank you very much!

2 answers

Log in to vote
2
Answered by 10 years ago
01GamePassID = 000 --Game Pass ID
02BadgeID = 000 --Badge ID
03prompt = true --Change to anything if you want it to prompt a purchase pannel
04 
05game.Players.PlayerAdded:connect(function(player)
06    GPS = game:GetService("GamePassService")
07    BS = game:GetService("BadgeService")
08    if GPS:PlayerHasPass(player, GamePassID) then
09        BS:AwardBadge(player,BadgeID)
10    elseif prompt == true then
11        game:GetService("MarketplaceService"):PromptPurchase(player,GamePassID)
12    end
13end)
Ad
Log in to vote
-5
Answered by 10 years ago

i dont know.

Answer this question