Hi, So I’m making a GravityCoil Gamepass for my game and I used this script in my “PromptGiver” Mesh
local gamePassId = 129664595
local db = false
script.Parent.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr and not db then
if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr, gamePassId) then
db = true
local newItem = game.ReplicatedStorage:FindFirstChild("GravityCoil"):Clone()
newItem.Parent = plr.Backpack
wait(1)
db = false
else
game:GetService("MarketplaceService"):PromptGamePassPurchase(plr, gamePassId)
end
end
end
end)
Although I have the GravityCoil in ReplicatedStorage, It reshows the purchaseprompt of the gamepass again and won’t place the grav coil in my backpack? How could I fix this?
local MarketplaceService = game:GetService("MarketplaceService")
if MarketplaceService:UserOwnsGamePassAsync(plr.UserId, gamePassId) then
-- the rest of your code
end
local gamePassId = 129664595
local db = false
script.Parent.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr and not db then
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr, gamePassId) then
db = true
local newItem = game.ReplicatedStorage:FindFirstChild("GravityCoil"):Clone()
newItem.Parent = plr.Backpack
wait(1)
db = false
else
game:GetService("MarketplaceService"):PromptGamePassPurchase(plr, gamePassId)
end
end
end
end)