Gamepass not giving me anything for buying it!

How, I didn’t put any parameters for the remote event.

What I recommend you do is use the PromptGamePassPurchaseFinished event and check if the wasPurchased parameter returned true. If yes, then grant them the tool.

That makes it easier, all they have to do is fire the event.

Oh yea lol, I jsut noticed that. Then to stop hackers from getting the tool, you would check if they have the gamepass serverside.

local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")


RemoteEvent.OnServerEvent:Connect(function(plr, Id)
	local OwnsGamePass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, Id)
if OwnsGamePass == true then
	if plr.Character then
		local Tool  = game.ReplicatedStorage:WaitForChild("Darkheart")
		local Clone = Tool:Clone()
		if Tool ~= nil and Clone ~= nil then
		Clone.Parent = plr.Backpack
		end
	else
		return
		end
	end
end)

That wouldn’t work if the Player just bought the gamepass due to Roblox’ caching behaviour. It doesn’t send a request for each time the function is called, it just “remembers” it.

Also, what’s the point of having a local script, if you’re rechecking if the player owns the game pass on the server?

Yea, I know. I was gonna tell him to remove it.

@Dev_BB1 Overall, I recommend you use PromptGamePassPurchaseFinished and check if the wasPurchased parameter returned true or not.

Okay, nothing is giving me the sword. This is super weird. The gamepass is on sale. The weapon is in server script service. Everything should be working fine. I don’t know why it doesn’t work for me and my friend.

Did your steps, nothing happened again. I’m actually confused why it doesn’t work.

It’s works for me. If it doesn’t work then you don’t own the game pass.

That’s weird. I should own it. My friend made the gamepass when we were in team create. Can you test purchase a gamepass you didn’t make?

Since the same script is working for others, why don’t you try and turn on API services?
Not sure if it will work, but if everyone else isn’t having any problems with this script its likely some setting that you don’t have turned on.

Try this: (put script in workspace, player will have to rejoin) This script worked for me.

game.Players.PlayerAdded:connect(function(player)
local mkps = game:GetService("MarketplaceService")
local ss = game.ServerStorage -- Put Darkheart sword in serverstorage

 repeat wait(0.1) until player.Backpack
repeat wait(0.1) until player.StarterGear

if mkps:UserOwnsGamePassAsync(player.UserId, 18895332) then  -- player.UserId, (gamepassid)
	ss.(toolname):Clone().Parent = player.Backpack 
	ss.(toolname):Clone().Parent = player.StarterGear
end

end)

You don’t own the gamepass though. You need to own it OUT of studio.

Use MarketplaceService.PromptGamePassPurchaseFinished to detect whether you’ve bought it. This works with buying in studio.

1 Like

It says in his Devfourm bio not his this is not his main account, he uses his main account in studio.

1 Like