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

Can someone tell me how to script a gamepass to give PBS building tools?

Asked by 10 years ago

I'm quite new to scripting, and I honestly have no idea how to do this. Could anybody tell me how?

1 answer

Log in to vote
0
Answered by 10 years ago

To what I understand, PBS is some kind of tool right? If so, you will need the put PBS in Lighting and put this code in Workspace.

PBS = game.Lighting.PBS --The path to the tool
prompt = true --Set to anything else than true if you don't want a purchase Game Pass panel popping up
GamePassID = 000 --Change this to the Game Pass ID

game.Players.PlayerAdded:connect(function(player) --when a player is added
    GPS = game:GetService("GamePassService")
    if GPS:PlayerHasPass(player,GamePassID) then --Checks if it has the Pass
        a = PBS:Clone() --If so, PBS is copied into the player's backpack
        a.Parent = player.Backpack
    elseif prompt == true and player.Name:sub(1,6) ~= "Guest " then --Checks if the player's name is not a guest...
        game:GetService("MarketplaceService"):PromptPurchase(player,GamePassID)
    end
end)
Ad

Answer this question