Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Vip game pass gives walkspeed (Not working?)

Asked by 6 years ago
Edited 6 years ago

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

1game.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)
7end)

3 answers

Log in to vote
2
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

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

01local id = -- your gp Id here
02local m = game:GetService('MarketplaceService')
03 
04game.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)
11end)
0
Thanks! Vibesgus 35 — 6y
Ad
Log in to vote
3
Answered by
piRadians 297 Moderation Voter
6 years ago

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.

1game.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)
7end)
Log in to vote
0
Answered by
angeI1001 123
6 years ago

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

1game: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
7end)
0
The reason why I put the check above the charcteradded event is because you don't need to check everytime a player respawns. angeI1001 123 — 6y
0
What is they delete the game pass and then respawn User#19524 175 — 6y
0
In that case you would do the check everytime they respawn. angeI1001 123 — 6y

Answer this question