Problems with a gamepass script

Hey, I’m not really a scripter and the scripter who worked in my development team left, which pretty much means that I’m having ridiculous problems with the scripting department of my group. So I got my friend to make this script. It’s basically a gamepass script as in: If you buy the gamepass with this ID you’ll get this tool (in this case the shortblade). I’ve tried several times in different games even. I’ve put the Script itself in workspace and the Shortblade in lightning as it says in the script but it just can’t seem to work. Would truly appreciate if anyone could help me out and see whats wrong because I’m going to be launching advertisements tomorrow and I really need this script to be prepared.

id = 3730293 --Put that id here 
tools = {"Bow"} 
MPS = game:GetService("MarketplaceService")
function respawned(char)
    local player = game.Players:FindFirstChild(char.Name)
    print("Character Respawned")
    if char:FindFirstChild("Head") ~= nil then
        print("Real Player")
        if MPS:PlayerOwnsAsset(player, id) then
            print("Player Owns")
            for i = 1,#tools do
                game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
            print("Play doesn't own.")

There are a lot of issues with this script…It will almost certainly never work. I can probably rewrite it in this forum, though, if you can just give me the actual location of this Bow object that you want to give players. That is, is it in ServerStorage, somewhere else? Where?

1 Like

the location is in lightning, thats where I’ve placed it

Then try this:

local Lighting = game:GetService("Lighting")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local gamepassId = 3730293 --Put that id here 
local toolNames = {"Bow"}
local toolsParent = Lighting

local function onPlayerAdded(player)
    local function onCharacterAdded(character)
        if MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassId) then
            for i = 1, #toolNames do
                local tool = toolsParent:FindFirstChild(toolNames[i])
                if tool then
                    local clone = tool:Clone()
                    clone.Parent = player.Backpack

    if player.Character then


Thanks man, I tried it but for some reason It’s not working. I’m sure the gamepass ID is right I’ve checked serveral times and I’ve but the Bow in the right place.

You didn’t copy it all. You’re missing a ‘)’ at the end.

Oh god Thanks for telling me, Doing another attempt

It actually works now Thank you for the help, Truly appreciated!

1 Like

If your problem has been solved, please mark the reply that solved your problem as a “solution”. You’ll find a check mark next to the reply that solved your problem. Just for future references, and so people know your problem has been solved.

This might help you in the long run it covers all MarketplaceService stuff & more