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

Walkspeed gamepass not giving the player extra speed?

This walkspeed gamepass is not giving the player extra speed if owned. Here's my script:

local passId = 4650300 
game.Players.PlayerAdded:connect(function(player)
    local function isAuthenticated(player)
       return game:GetService("GamePassService"):PlayerHasPass(player, passId)
    end
	print("i think it works")
    if isAuthenticated(player) then
  		repeat wait() until player.Character.Humanoid
        player.Character.Humanoid.WalkSpeed = 24---Change this line to what you want the Game Pass to do.
		print("it does work!")
    end
end)

It prints "i think it works" but it doesn't print ("it does work")

Also, as an extra, how could I make it so that the player can buy the gamepass in game? Thanks.

1 answer

local passId = 4650300
local function isAuthenticated(player)
	return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
	if isAuthenticated(plr) then
		repeat wait() until game.Players.LocalPlayer.Character.Humanoid
		game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 24
	end
end)

You should not have functions inside of the PlayerAdded event. Hopefully this works, I didn't try it though.

4 comments

0

16:33:49.595 - GamePassId '4650300' is not of type Game Pass. Please use MarketplaceService:PlayerOwnsAsset instead.

0

I replaced line 3 with return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId) and it still doesn't work

0

That means you have the wrong ID of the Game Pass, or you have not created the Game Pass

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