If someone owns a gamepass if unlocks some knives script

Hey everyone! I need some help with this script, where if you own a gamepass, you unlock the knife. I tried changing the local PackName to the gamepass name, but I don’t think that’s quite right, since im new to scripting.

local shopData = {
	Texture = 'rbxassetid://881557754';
	Mesh = "rbxassetid://79401392",
	MeshSize = Vector3.new(1, 1, 1);
	ShopHandleOffset = CFrame.new() * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0));
	ItemDescription = "lol this is sample";
	ItemName = "Tix Bullets";
	Price = 3000;
	TierName = "CUSTOM",
	OwnerData = {"Coding_Abudiak", "https://www.roblox.com/Thumbs/Avatar.ashx?x=420&y=420&username=Nettimato", "Coding_Abudiak"}
}

local importance = 999
local PackName = "Tix Pack"

local function CanDisplay(PlayerData, name)
	if _G.CLIENT_DATA ~= nil and _G.CLIENT_DATA.PlayerSession ~= nil then
		return _G.CLIENT_DATA.PlayerSession["Owned_Passes"][PackName] -- Name of the pack
	end
	return false
end

return {shopData, importance, CanDisplay} 

I don’t recommend using names to track gamepasses ( I don’t think it’s even possible ).
You need to get the gamepass ID instead of the name.

so do i replace “Tix Pack” with a gamepass ID? Will that work instead?

Here is a video of how to use gamepasses and how to script a working gamepass.

Nevermind, there was another script holding all the gamepassIDs, but thanks anyway! :slight_smile:

1 Like