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

Best way to give players an ability if they have a gamepass?

Hello,

I have a localscript in the StarterPack that grants everyone the ability to fly. I want to know the best way to only give players with a certain gamepass this ability. For example, should I copy this script into the players StarterPack like you would do with gear?

Thanks for the help!

1 comment

0

replied to ur comment

1 answer

here's an example code

more information here and here

game.Players.PlayerAdded:Connect(function(plr)
 if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, 1743777) then
--do stuff--
  end
end)

UserOwnsGamePassAsync returns true if the Player with the given UserId owns the game pass with the given game pass ID (not to be confused with asset ID).

3 comments

0

So would I put the script into the ReplicatedStorage and copy it into the players inventory if they have the gamepass?

0

no, all you need to do is put this in serverscriptservice

0

No i mean the flying script

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