Help with finishing gamepass

I need help creating a simple gamepass script. I have tried several tutorials and they’re either outdated or not what I am looking for.

I already have a script that makes it so when you click a button, you’re prompted to buy the speed coil. I need help with a script that would actually automatically give the player in-game the speed coil, when they have the gamepass.

I can’t provide the script but, I would suggest learning how purchases work and PurchasePrompt in studio.

Check this out; Roblox Gamepass Script Tutorial | Roblox Studio 2021 - YouTube

Also would help if you looked at the roblox developer wiki

Not sure if you’d know this but, I ended up using this video:

and it worked, however once I got the item and equipped it in-game, it provided me no speed.

If the actual gamepass prompt feature worked, then it’s fine, although with the speed that would be due to an error with the script in the tool.

That’s what i thought, but when tested outside of the gamepass script by itself, everything worked fine including the speed script.

It is when I moved it into ReplicatedStorage and scripted that the item no longer functions.

Can you send the script? And is it serverside?

local player = game.Players.LocalPlayer
local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,8222423)

if ownsGamepass then
 local sword = game:GetService("ReplicatedStorage"):WaitForChild("SpeedCoil"):Clone()
 sword.Parent = player.Backpack
end

This is what it should look like if you’re giving tools to the player via gamepasses;

local MarketPlaceService = game:GetService("MarketplaceService") -- Get's the service so we can make the gamepass
local GamepassID = 00000-- The Gamepass ID

game.Players.PlayerAdded:Connect(function(player)

	if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamepassID) then -- Checking if the player owns the gamepass

		game.ServerStorage.SpeedCoil:Clone().Parent = player:WaitForChild("Backpack") -- Putting the tool into the players backpack
		game.ServerStorage.SpeedCoil:Clone().Parent = player:WaitForChild("StarterGear")  -- Finding  the tool from ServerStorage 
	end
end)

ill give it a try and let you know what happens.

also where are you putting your localscript?

Now its not even giving me the item…

I must have the script in the wrong place because I triple checked and it is the same as yours

It should be in ServerScriptStorage – just replace the GamepassID with yours.

Also make sure to have the tool your giving in ServerStorage

Works now. Many thanks!!

(pretty easy just took me a minute)

(LOCAL SCRIPT) Try to put this on the button -

local plr = game.Players.LocalPlayer

local button = script.Parent

local MarketplaceService = game:GetService("MarketplaceService")

script.Parent.MouseButton1Click:Connect(function()

MarketplaceService:PromptGamePassPurchase(plr, 0) -- Your gamePass Id Here

end)