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!