Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.