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.

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

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

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)
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.

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)


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:


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)
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