script.Parent.MouseButton1Click:Connect(function()
	game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,10343847)
end)

I used these scripts to make a gamepass for a gravity coil and I was able to get the item in my inventory, but the gravity coil has no function ONLY when it is in the replicated storage. It worked just fine when it was in the starter pack but when I move the item to the replicated storage I can only hold the item. I'm really confused on why it doesn't work in replicated storage and I'm not sure what I have to do to fix it.

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

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

2 comments

0

Maybe The Script Gets Disabled?

0

That is because your backpack is not replicated storage. It won't work until the tool is actually in your backpack.