This Game pass should give you 50+ Walkspeed, but it doesn't.
1 | game.Players.PlayerAdded:Connect( function (player) |
2 | player.CharacterAdded:Connect( function (character) |
3 | if game.MarketplaceService:PlayerOwnsAsset(player, 5259694 ) then |
4 | character.Humanoid.WalkSpeed = 50 |
5 | end |
6 | end ) |
7 | end ) |
Game Passes are not classified as assets anymore, therefore you shouldn't use PlayerOwnsAsset. An alternative is to use UserOwnsGamePassAsync
01 | local id = -- your gp Id here |
02 | local m = game:GetService( 'MarketplaceService' ) |
03 |
04 | game.Players.ChildAdded:Connect( function (player) |
05 | player.CharacterAdded:Connect( function (char) |
06 | if m:UserOwnsGamePassAsync(player.UserId, id) then |
07 | local h = char:WaitForChild( 'Humanoid' ) |
08 | h.WalkSpeed = 50 |
09 | end |
10 | end ) |
11 | end ) |
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.
1 | game.Players.PlayerAdded:Connect( function (player) |
2 | player.CharacterAdded:Connect( function (character) |
3 | if game.MarketplaceService:UserOwnsGamePassAsync(player.UserId, 5259694 ) then |
4 | character.Humanoid.WalkSpeed = 50 |
5 | end |
6 | end ) |
7 | end ) |
I'd like to mention that you should always use GetService() on every service except workspace. So it would be like this:
1 | game:GetService( "Players" ).PlayerAdded:Connect( function (Player) |
2 | if game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(Player.UserId, 5259694 ) then |
3 | Player.CharacterAdded:Connect( function (Char) |
4 | Char:FindFirstChild( "Humanoid" ).WalkSpeed = 50 |
5 | end ) |
6 | end |
7 | end ) |