local mps = game:GetService("MarketplaceService")
local gamepass_id = 7142544
game.Players.PlayerAdded:Connect(function(player)
if mps:UserOwnsGamePassAsync(player.UserId, gamepass_id) then
game.ServerStorage.Gun:Clone().Parent = player:WaitForChild("Backpack")
game.ServerStorage.Gun:Clone().Parent = player:WaitForChild("PlayerGear")
end
end)
game.ReplicatedStorage.Give.OnServerEvent:connect(function(player)
game.ServerStorage.Gun:Clone().Parent = player:WaitForChild("Backpack")
game.ServerStorage.Gun:Clone().Parent = player:WaitForChild("PlayerGear")
end)
---------------------------------------------
And here's The second one!
---------------------------------------------
local mps = game:GetService("MarketplaceService")
local gamepass_id = 7142544
script.Parent.MouseButton1Click:connect(function()
local player = game.Players.LocalPlayer
mps:PromptGamePassPurchase(player, gamepass_id)
end)
mps.PromptGamePassPurchaseFinished:connect(function(player, id, purchased)
if id == gamepass_id and purchased then
game.ReplicatedStorage.Give:FireServer()
end
end)
✓ ANSWER ACCEPTED
When Gamepass bought you get tool! [MY SCRIPT NOT WORKING WHY?]
1 answer
✓ Accepted answer
Do you have your process receipt function set up? According to this page,
"For developer product purchase prompts, connect to >MarketplaceService.PromptProductPurchaseFinished. In order to process such purchases you >need to set the ProcessReceipt callback in a single script."
Also, check if the gamepass was purchased on the server instead of firing an event from the player. Hackers can just fire that event and it acts like they bought the gamepass.
2 comments
0
ok thx
0
no problem tell me if you need any more help and sorry for the bad formatting
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
format your code
how?
there