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

Give a player a gear when they buy a gamepass?

How can I give a player that has a gamepass a certain gear in their in-game inventory?

Thank you!

1 answer

That would be pretty easy, you would have a gear in ReplicatedStorage and use the PlayerHasPass method to check if the player has the item. Then, you would clone the gear into the Player's backpack

Example:

function ifplayerhasPass(Player)
	return game:GetService("GamePassService"):PlayerHasPass(Player,passid )
end
game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(Character)
		if ifplayerhasPass(player) then
			print("Player has the GamePass")
			local abc = game.ReplicatedStorage.SpeedCoil:clone()
			abc.Parent = player.Backpack
		end
	end)
end)

1 comment

1

Could you give an example in code block? I'm completely oblivious to how to code Lua

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