Game Pass Won't Give Player Item When Bought

I have a script that mostly works, but when bought, will not give the player the item.
Here is the script:

Script

local market = game:GetService(“MarketplaceService”)
local passID = 1
local passID2 = 1
local passID3 = 1
local passID4 = 1

game.Players.PlayerAdded:Connect(function(player)
if market:UserOwnsGamePassAsync(player.UserId, passID) then
game.ServerStorage[“GravityCoil”]:Clone().Parent = player.Backpack
elseif market:UserOwnsGamePassAsync(player.UserId, passID2) then
game.ServerStorage[“SpeedCoil”]:Clone().Parent = player.Backpack
elseif market:UserOwnsGamePassAsync(player.UserId, passID3) then
game.ServerStorage[“FusionCoil”]:Clone().Parent = player.Backpack
elseif market:UserOwnsGamePassAsync(player.UserId, passID4) then
game.ServerStorage[“RainbowMagicCarpet”]:Clone().Parent = player.Backpack
end
end)

market.PromptGamePassPurchaseFinished:Connect(function(player, pass, bought)
if pass == passID and bought then
game.ServerStorage[“GravityCoil”]:Clone().Parent = player.Backpack
elseif pass == passID2 and bought then
game.ServerStorage[“SpeedCoil”]:Clone().Parent = player.Backpack
elseif pass == passID3 and bought then
game.ServerStorage[“FusionCoil”]:Clone().Parent = player.Backpack
elseif pass == passID4 and bought then
game.ServerStorage[“RainbowMagicCarpet”]:Clone().Parent = player.Backpack
end
end)

Everything is named correctly, I don’t know what’s wrong, could someone please help me? Thank you and have a nice day!

I don’t know too much about this stuff, as I am a beginning developer.

However, if you haven’t already. I would recommend not making the gamepass able to be bought by the public.

1 Like

What do you mean? Don’t most games sell game passes?

I mean take the gamepass offsale until the problem is fixed.

1 Like

I have not released this update.

This script doesn’t give every item in the list. Because if the if statement is the one if i can say it like that then it stops and only give that item.

2 Likes

Okay good. Leaving the gamepass on sale would cause some problems with the younger Roblox players…

1 Like