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

How to find the gamepass id for my game?

How to I find the gamepass id for my gamepass?

4 comments

0

Thx so much. Also how to -- Assign this player the ability or bonus related to the game pass --

0

Like I wanna make a game pass for walk speed

0

I wanna make a gamepass for a radio how would i find the gamepass id for that? im really stuck.

2 answers

✓ Accepted answer

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

0

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.

0

I've edited my answer to give you most of the code you'll need, and added a tidbit on the gamepass ID.

0

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.

0

You'd set the humanoid's WalkSpeed property: http://wiki.roblox.com/index.php?title=API:Class/Humanoid/WalkSpeed

0

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

0

Or I should put in the "make sure the part still exists" code too?

0

Don't need to return if it doesn't exist, I'll edit my code to help with this.

0

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.