How do i make a invetory for gamepasses

So basically i got 2 tools in replicatedstorage. and i already got a script that gives them to the players invetory if they own the gamepass. the problem is that the tools dissapear from the players invetory after he dies, so i tried making an equip gui. i made it but i dont know how to detect if a player already has the gamepass.

4 Likes

Make a boolvalue in your data and set it to true when the player purchased the gamepass. Then in your giving tool script, do that if boolvalue == true then … give the player the tools

1 Like

you can use gamepass service and a inbuilt function
edit: it might be marketplaceservice i forgor

1 Like

How would i do that exactly? (sry if im annoying)

you got a script that saves player data (gold, gems…)?

Could you somehow give me an example?

i don’t think soooooooooooo. eh

just do this local userownsgamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(1,1) replace the first value with the player you want to checks id and the second with the gamepass id then this will return a value if its true they own it if returns false they dont

1 Like

Put it in StarterPack & Backpack, not just the Backpack.

You can use MarketplaceService:UserOwnsGamePassAsync()

1 Like

Should the script look like this?

script.Parent.MouseButton1Click:Connect(function()
	local MPC = game:GetService("MarketplaceService")

	game.Players.PlayerAdded:Connect(function(plr)
		if MPC:UserOwnsGamePassAsync(plr.UserId, 236958295) then
			game.ReplicatedStorage.Mega:Clone().Parent = game.Players.LocalPlayer.Backpack
		end
	end)
end)

Yes it should, I think. If it doesn’t tell us.

IT actually doesnt work. ehhhhh

No, first of all, you can’t give the tool via a local script. You don’t need PlayerAdded since you can just call the player = game.players.localplayer, you can fire a remote event from local script to server script and handle the tool giving on server.

any errors in the output tab?.

I think im not gonna waste time making an invetory, maybe we will try to make the tools clone into player’s invetory everytime he dies, but how

why the .Parent? Why would you use .Parent after the clone?

  1. Why are you connecting PlayerAdded.
  2. It’s a local script and wont replicate.

My brother is an exploiter and sometimes he just flexes on me that “omg i can give myself tools” and once i looked at his script and it had :Clone().Parent, so i basically always used :Clone().Parent

Does it have to be on server if it concerns tools?