So basically I want to remove a tool from a players backpack if they don't have the gamepass. I tested this out since I don't have the pass. It doesn't remove the FAL when it's in my backpack. It's a localscript in starterpack.
local player = game.Players.LocalPlayer if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 415462481) then print ("FAL pass owned") else while true do player.Backpack.FAL:Destroy() end end
I personally think it would be a better idea to store the tool in ReplicatedStorage (or ServerStorage) and clone the tool to the player's backpack when they spawn if they own the gamepass. An exploiter could potentially disable this script.
local tool = game.ReplicatedStorage.FAL -- Change to wherever you store the tool local gamepass = 415462481 game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function() if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 415462481) then -- Check if the own the tool tool:Clone().Parent = player.Backpack -- Clone it to their backpack end end) end)