Gamepass tool getting gone from the player's backpack when the players respawns

Hello, I have a gamepass tool script from @SOTR654, but whenever the player repawns, the tool gets gone from the player’s backpack.
The script is inside ServerScriptService, and the tool is located in ServerStorage.
Here is the script:

game.Players.PlayerAdded:Connect(function(player)
	local success, boughtGamepass = pcall(function()
		return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 19237735)
	end)
	
	if success and boughtGamepass then
		local winterStick = game:GetService("ServerStorage"):WaitForChild("WinterStick"):Clone()
		winterStick.Parent = player.Backpack
	end
end)

Is there a solution to fix this problem? Thank you.

1 Like

Yes one sec i’ll do the script for you :slight_smile:

2 Likes

Try this :slight_smile:

local Serv = game:GetService("GamePassService")
local MServ = game:GetService("MarketplaceService")

local vtool = game:GetService("ServerStorage"):WaitForChild("WinterStick"):Clone()

game.Players.PlayerAdded:Connect(function(player)
	local success, boughtGamepass = pcall(function()
		return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 19237735)
	end)

	if success and boughtGamepass then
		vtool:Clone().Parent = player.Backpack
	end
end)

workspace.ChildAdded:Connect(function(char)
	local getpl = game:GetService("Players"):FindFirstChild(char.Name)
	if char:FindFirstChild("HumanoidRootPart") ~= nil then
		if MServ:UserOwnsGamePassAsync(getpl.UserId, 19237735) then
			vtool:Clone().Parent = getpl.Backpack
		end
	end
end)
4 Likes

game.Players.PlayerAdded:Connect(function(player)
local success, boughtGamepass = pcall(function()
return game:GetService(“MarketplaceService”):UserOwnsGamePassAsync(player.UserId, 19237735)
end)

if success and boughtGamepass then
	local winterStick = game:GetService("ServerStorage"):WaitForChild("WinterStick"):Clone()
	winterStick.Parent = player.Backpack
            local owinterstick = winterStick:Clone()
            owinterstick.Parent = player.StarterGear
end

end)

1 Like

oh nevermind you did lol chars

2 Likes

local MPS = game:GetService(“MarketplaceService”)
local winterStick = game:GetService(“ServerStorage”):WaitForChild(“WinterStick”)

game.Players.PlayerAdded:Connect(function(player)
local ownGamepass = MPS:UserOwnsGamePassAsync(player.UserId, 19237735)

player.CharacterAdded:Connect(function(char)
	if ownGamepass then
		winterStick:Clone().Parent = player.Backpack
	end
end)

end)

1 Like

Maybe try something like this so when the player/player’s who own it, when they respond then they have the gear added to their backpack

1 Like

I think when you do “StarterGear”, then the whole server gets the tool instead of the player with the gamepass getting the tool.

2 Likes

Thank you, your script worked, Can I use this script for my game?

1 Like

Yes you can, I made this for you too so have fun :slight_smile:

1 Like

every player has their own StarterGear , so it will not give every players :slightly_smiling_face:

edit: anyways use the script that Shyzuu did

1 Like