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

How do I fix a functional walkspeed gamepass?

Asked by 5 years ago
Edited 5 years ago

I have a script for a walkspeed gamepass, but it semms to not work. Help, please! Here's the script

local passId = 5076109 
game.Players.PlayerAdded:connect(function()
    function isAuthenticated(player) 
       return game:GetService("GamePassService"):PlayerHasPass(player, 5076109)
    end

    game.Players.PlayerAdded:connect(function(plr)
         if isAuthenticated(plr) then
    repeat wait(0.001) until game.Players.LocalPlayer.Character.Humanoid
             game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = game.Players.LocalPlayer.Character.Humanoid.WalkSpeed + 36
         end
    end)
end)

0
Why doesn't the other end go in the script? LOL. Boyrock0093 -9 — 5y
0
Oh nvm Boyrock0093 -9 — 5y

1 answer

Log in to vote
0
Answered by
green271 635 Moderation Voter
5 years ago

There are some errors here.

PlayerHasPass vs UserOwnsGamePassAsync.

ROBLOX made some changes to their gamepass servers a while back, and as such they produced a superior method. UserOwnsGamePassAsync should be used as it is the most recent and up-to-date. It is a function of MarketplaceService. Here is a demo of the code:

game.Players.PlayerAdded:Connect(function(plr)
    if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, gamepassId) then
    print("Player owns pass!")
end)

connect vs Connect

connect is deprecated and should not be used in new work. Instead, use Connect.

Also to note, you should do WaitForChild rather then repeat wait() until.

0
Thanks, but how would I make it to give speed? Boyrock0093 -9 — 5y
0
Humanoids have a WalkSpeed propety. You can access it by doing: plr.Character.Humanoid.WalkSpeed green271 635 — 5y
Ad

Answer this question