Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Give a player a gear when they buy a gamepass? [closed]

Asked by 9 years ago

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

Thank you!

Locked by adark, Spongocardo, and BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
3
Answered by
Thetacah 712 Moderation Voter
9 years ago

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
Could you give an example in code block? I'm completely oblivious to how to code Lua DrCylonide 158 — 9y
Ad