I have been trying for a long time to get my gamepass scripts to work to give an item when bought but they aren't working if anyone please knows why they aren't working or has a working one please tell me in the answers. Much appreciated
local devidl = 4919176
game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(player,gamepassid,ispurchased)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId,devidl) == false then
if ispurchased == false then
if gamepassid == devidl then
local BackpackItem = game.ReplicatedStorage.SpeedCoil:Clone()
local StarterGearItem = game.ReplicatedStorage.SpeedCoil:Clone()
BackpackItem.Parent = player.Backpack
StarterGearItem.Parent = player.StarterGear
end
end
end
end)
game.Players.PlayerAdded:connect(function(player)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId,devidl) == true then
local BackpackItem = game.ReplicatedStorage.SpeedCoil:Clone()
local StarterGearItem = game.ReplicatedStorage.SpeedCoil:Clone()
BackpackItem.Parent = player.Backpack
StarterGearItem.Parent = player.Backpack
end
end)

8 comments
Can you please let us know what the error is if there is any and what is going on? Is it not giving the item or?
please dont ask the same question twice, in the worst case bump it on the chat.
not giving the item
And is there any error in the console and if so what does it say/what line is it on?
Script type?
script
and it says no error
Where is the script kept?