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:

function hasPass(player,id) --Creating a simple function to see if the player has the GamePass with that id
 if game:GetService("GamePassService"):PlayerHasPass(player,id) then
  return true
 else 
  return false
 end
end



game.Players.PlayerAdded:connect(function(player)

 if hasPass(player,163409880) then --We're calling the function
  print(player.Name .. " has the GamePass!")


 if game:GetService("BadgeService"):UserHasBadge(p.userId, 93416536) then
        print("The user has this badge")

else
game:GetService("BadgeService")AwardBadge(p.userId, 93416536) end

 else print(player.Name .. " doesn't have the GamePass")

 end
end)

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
GamePassID = 000 --Game Pass ID
BadgeID = 000 --Badge ID
prompt = true --Change to anything if you want it to prompt a purchase pannel

game.Players.PlayerAdded:connect(function(player)
    GPS = game:GetService("GamePassService")
    BS = game:GetService("BadgeService")
    if GPS:PlayerHasPass(player, GamePassID) then
        BS:AwardBadge(player,BadgeID)
    elseif prompt == true then
        game:GetService("MarketplaceService"):PromptPurchase(player,GamePassID)
    end
end)
Ad
Log in to vote
-5
Answered by 10 years ago

i dont know.

Answer this question