Player does not spawn in with a speed coil even though they own the gamepass

I’ve recently been trying to figure out why I can’t spawn into my game with a speed coil in my inventory even though I already own the gamepass. I used UserOwnsGamePassAsync to check if the player has the gamepass, and if they already do, I put a clone of the speed coil in their inventory. But, if they don’t, I used PromptGamePassPurchase to let the player buy the gamepass. And finally, if the player has bought the gamepass, I used PromptGamePassPurchaseFinished and connected this to a function that checked if the player has bought the gamepass. Then, I put the clone of the speed coil into their inventory. But, for some reason, when I play the actual game, I do not spawn in with a speed coil even though I own the gamepass. Shouldn’t UserOwnsGamePassAsync check if I own the gamepass and then put the clone of the speed coil in my inventory?
Code is provided below, any help is appreciated. Thanks.


Does it give it to you the first time and afterwards no or never never gives you it? Also why is the code that checks if the user owns the gamepass in a pcall? It’s not needed, jsut do this to set the hasPass variable

local hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, SprintGamePassID)

The only thing I see wrong is a slight typo you have on line 12: it is UserId, not UserID. Make the D lowercase and then see what happens.

I changed all of parts where UserID showed up to UserId, but it still does not work, as shown in the video below.

Question:
image

Are you actually cloning the item here? Because I don’t see the Clone() function anywhere.

Try removing the pcall and using how I did to see if the player has the gamepass and see if that works

Nope, for some reason it did not work for me.

It doesn’t even spawn you in with the stuff? Does buying the gamepass work or does it suffer the same issue?

It says I own the gamepass but it does not spawn me in with a speed coil in my inventory.

Go back in studio and try buying the gamepass, from there and see if it works when you buy it, cause it may be an issue with the code to give you the coil itself

I tried adding the Clone method in but it still does not spawn me into the game with a speed coil in my inventory.

Try adding a print statement in the hasPass if statement to see if it even detects you have a gamepass when you’re ingame. Also whilst you’re in studio, check if buying the gamepass works and gives you the coil

Ok so it works when I play the game in Roblox Studio but it does not work when I actually play the game on the Roblox website.

Which does not work, the gamepass giving you the speed coil or getting the speed coil on join?

Getting the speed coil on join is the one that does not work.

Again, may try removing the pcall so the code in PlayerAdded is

hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, SprintGamepassID)

if hasPass then
   print("Player has gamepass!")
   local clone = game:GetService("InsertService"):LoadAsset(99119158):Clone()
   clone.Handle.Anchored = false
   clone.Parent = player.Backpack
end

Yep, I tried removing the pcall already but when I tested it on the local server in Roblox Studio, it did not work.

Did you also add a print and see if it will print ingame?

This printed while I was testing in Roblox Studio btw.

But does it also print ingame or doesn’t? Also where did you move most of the code?