How to I find the gamepass id for my gamepass?
How to find the gamepass id for my game?
2 answers
If you'd like to give player's abilities based on whether or not they own the gamepass, try MarketplaceService:UserOwnsGamePassAsync(): http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService/UserOwnsGamePassAsync
You could use the game.Players.PlayerAdded, check, and do X if the player owns the gamepass.
The ID of a gamepass can be obtained by going to it's page on the website and copying the numbers in the URL.
As for increasing walkspeed if they bought a gamepass, let's try this:
local MarketplaceService = game:GetService("MarketplaceService")
local GamepassId = 99999
local GamepassWalkspeed = 16 * 5
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
if not MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
return
end
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.WalkSpeed = GamepassWalkspeed
end)
end)
8 comments
Sorry, I am not really good at coding. Can you kind of give an example how to make a gamepass with walking speed boost, also I am also confused about the ID part. Sometimes the id refer to the other product.
I've edited my answer to give you most of the code you'll need, and added a tidbit on the gamepass ID.
ok, so for the set the walkspeed here! what kind of code should I put there? Can you give you an example. I know it is a dumb question but I really dont know how to code set the walkspeed XD. Thank you very much.
You'd set the humanoid's WalkSpeed property: http://wiki.roblox.com/index.php?title=API:Class/Humanoid/WalkSpeed
So I just insert this into where the set the walkspeed is? local humanoid = part.Parent:FindFirstChild("Humanoid") if not humanoid then return end -- change to five times faster than default speed humanoid.WalkSpeed = 16 * 5
Or I should put in the "make sure the part still exists" code too?
Don't need to return if it doesn't exist, I'll edit my code to help with this.
thx so much! also, does this code I sent work for gamepass for super jump? How do you combine two those codes together in one script?
``local MarketplaceService = game:GetService("MarketplaceService")
local GamepassId = 4460052
local GamepassJumpPower = 50 * 20
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
if not MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
return
end
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.WalkSpeed = GamepassJumpPower
end)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Check the wiki before posting here. Thanks. http://wiki.roblox.com/index.php?title=Game_Passes_%E2%80%93_Abilities_and_Bonuses
Thx so much. Also how to -- Assign this player the ability or bonus related to the game pass --
Like I wanna make a game pass for walk speed
I wanna make a gamepass for a radio how would i find the gamepass id for that? im really stuck.