How to give the player the tool if he has the gamepass upon joining the game

  1. What do you want to achieve?
  • if the player has the gamepass, he/she will be given the tool upon joining
  1. What is the issue?
    it doesnt give the tool to the player upon joining

this is my code:

local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ToolID = 15844440	

players.PlayerAdded:Connect(function(player)
	wait(1)
	if MarketPlaceService:UserOwnsGamePassAsync(player.UserID,ToolID) then
		print(player.Name.."Owns Gamepass")
	end
end)

There’s no code that gives the tool upon joining and they have the gamepass.

local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local Tool = --Your tool's location that matches the ID
local ToolID = 15844440	

players.PlayerAdded:Connect(function(player)
	wait(1)
	if MarketPlaceService:UserOwnsGamePassAsync(player.UserID,ToolID) then
		print(player.Name .. " has the gamepass")
		Tool.Clone().Parent = player.Backpack
		Tool.Clone().Parent = player.StarterGear
	end
end)

This code will be simple enough for a single tool, but you’ll have to fix it up a bit if you plan on adding more tool gamepasses

2 Likes

oh thanks for the help

wait btw youre the one who help me with my problem yesterday…
Thank you for answering my questions i deeply appreciate it

1 Like

Yup, I’m the same one who helped yesterday haha. And anytime! If you have anymore issues don’t be afraid to make another post!

1 Like