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

Vip game pass gives walkspeed (Not working?)

This Game pass should give you 50+ Walkspeed, but it doesn't.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		if game.MarketplaceService:PlayerOwnsAsset(player,5259694) then
			character.Humanoid.WalkSpeed = 50
		end
	end)
end)

3 answers

✓ Accepted answer

Game Passes are not classified as assets anymore, therefore you shouldn't use PlayerOwnsAsset. An alternative is to use UserOwnsGamePassAsync

local id = -- your gp Id here
local m = game:GetService('MarketplaceService')

game.Players.ChildAdded:Connect(function(player)
     player.CharacterAdded:Connect(function(char)
          if m:UserOwnsGamePassAsync(player.UserId, id) then
               local h = char:WaitForChild('Humanoid')
               h.WalkSpeed = 50
          end
     end)
end)

1 comment

0

Thanks!

GamePassed are NO LONGER Assets. They are their own class now. You must use the method UserOwnsGamePassAsync and the first argument should be the player's UserId.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        if game.MarketplaceService:UserOwnsGamePassAsync(player.UserId,5259694) then
            character.Humanoid.WalkSpeed = 50
        end
    end)
end)


I'd like to mention that you should always use GetService() on every service except workspace. So it would be like this:


game:GetService("Players").PlayerAdded:Connect(function(Player)
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, 5259694) then
		Player.CharacterAdded:Connect(function(Char)
			Char:FindFirstChild("Humanoid").WalkSpeed = 50
		end)
	end
end)

3 comments

0

The reason why I put the check above the charcteradded event is because you don't need to check everytime a player respawns.

0

What is they delete the game pass and then respawn

0

In that case you would do the check everytime they respawn.

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