Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I fix a functional walkspeed gamepass?

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)

2 comments

0

Why doesn't the other end go in the script? LOL.

0

Oh nvm

1 answer

✓ Accepted answer

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.

2 comments

0

Thanks, but how would I make it to give speed?

0

Humanoids have a WalkSpeed propety. You can access it by doing: plr.Character.Humanoid.WalkSpeed

This discussion is preserved as it was. New answers, comments, and votes are closed.