I am trying to make a gravity coil game pass but I am facing a lot a trouble.
-
I am trying to make it so that when you press the image button you buy the game pass and get the item.
-
When I press the image button it prompts the purchase like expected but when I buy it it gives me nothing.
My Problem Video -
I tried watching tutorials on YouTube but they unfortunately it did not help me and when I took a thorough search on the forum but I did not see anything that would help me.
So if anyone know what I can do in these codes to make it work please help.
local player = game.Players.localPlayer
local button = script.Parent
local MarketplaceService = game:GetService("MarketplaceService")
script.Parent.MouseButton1Click:Connect(function()
MarketplaceService:PromptGamePassPurchase(player,17590407)
end)
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local gamePassID = 17590407
function Spawned(player)
local HasGamepass = false
local success, message = pcall(function()
HasGamepass = MarketplaceService:UserOwnsGamePassAsync(player.userId, gamePassID)
end)
if not success then
warn("Checking In Player Has Gamepass" .. tostring(message))
return
end
if HasGamepass == true then
game.ServerStorage.GravityCoil:Clone().Parent = player.Backpack --Change GravityCoil To Your Tool/Gear Name
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
Spawned(player)
end)
end)
Players.PlayerSpawned:Connect(Spawned)