I'm trying to make a script so that if a character has a gamepass their walkspeed is increased to 25. No errors are showing up in output, so I don't know what's wrong. The script is a server script found under ServerScriptService. Am I missing something here?
1 | for i, v in pairs (game.Players:GetPlayers()) do |
2 | if v then |
3 | if game:GetService( "MarketplaceService" ):PlayerOwnsAsset(v, 880299391 ) then |
4 | v.Character.Humanoid.WalkSpeed = 25 |
5 | end |
6 | end |
7 | end |
Try using
1 | repeat wait() until game.Players.LocalPlayer |
2 | local service = game:GetService( "MarketplaceService" ) |
3 | for i,v in pairs (game.Players:GetChildren()) do |
4 | if v then |
5 | if service:PlayerOwnsAsset(v, 880299391 ) then |
6 | v.Character.Humanoid.WalkSpeed = 25 |
7 | end |
8 | end |
9 | end |