Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Whats wrong with my gamepass script that gives an item when bought?

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

0

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?

0

please dont ask the same question twice, in the worst case bump it on the chat.

0

not giving the item

0

And is there any error in the console and if so what does it say/what line is it on?

0

Script type?

0

script

0

and it says no error

0

Where is the script kept?

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.