Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Gamepass not giving gear?

When i join the game it gives me the gamepass gear, but if i rejoin the same server i dont receive the gear. Please help

local id = 357757288

game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then 
        game.ReplicatedStorage.GravityCoil:Clone().Parent = player.Backpack
        game.ReplicatedStorage.GravityCoil:Clone().Parent = player.StarterGear
	else
        print("No gravitycoil gamepass")
    end
end)

2 comments

0

Does it give an error at all?

0

no it doesnt

2 answers

id = 287822673 -- Edit to your gamepass id
tools = {'GravityCoil','SpeedCoil'} -- change to tool names
RS = game:GetService('ReplicatedStorage') -- tool storage
MPS = game:GetService("MarketplaceService") -- Better use than gamepass service

game.Players.PlayerAdded:connect(function(player)
    if MPS:PlayerOwnsAsset(player, id) then 
for i = 1,#tools do
RS:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
RS:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
    else
        print("Player doesn't have gamepass")
    end
end)

What I did is changed gamepass service to marketplaceservice for better use with gamepasses. I added a table for use of more than 1 tool. It works, I've tested it.

2 comments

0

don't forget to change the ID to the person using it

0

I should have done that earlier but yea

Try using

game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then 
     		 local backpackclone =  game.ReplicatedStorage.GravityCoil:Clone() 
			 backpackclone.Parent = player.Backpack
        	local startergearclone = game.ReplicatedStorage.GravityCoil:Clone()
			startergearclone.Parent = player.StarterGear
  		  else
        print("No gravitycoil gamepass")
    end
end)

I made the clones local, and then defined their parents. I've never gotten what you had, game.ReplicatedStorage.GravityCoil:Clone().Parent = player.Backpack to work for me.

4 comments

0

nope

0

Use marketplace service, it's better than gamepassservice in a way

0

can you show me a example?

0

well with GamePassService, you would have to join a new server for it to take effect. MarketPlaceService would take effect once you reset or rejoin a server

This discussion is preserved as it was. New answers, comments, and votes are closed.