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

Is there a script for increasing walk speed when you own a certain game pass?

this what i have tried but it does not work:

local passId = 5778889

game.Players.PlayerAdded:connect(function()

function isAuthenticated(player)

return game:GetService("GamePassService"):PlayerHasPass(player, passId)

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 +100

end)

end)

3 comments

0

This is not a request site.

0

He is not making a request. He is showing code that he is trying to fix.

0

in function isAuthenticated(player) return game:GetService(“GamePassService”):PlayerHasPass(player, passId) end. You just defined a function, but never actually ran it.

2 answers

local passId = 5778889

function isAuthenticated(player)
    return game:GetService(“MarketplaceService”):UserOwnsGamePassAsync(player.userId, passId)
end

game.Players.PlayerAdded:connect(function(plr)
    if isAuthenticated(plr) then
	    repeat wait() until plr.Character

	    plr.Character:WaitForChild("Humanoid").WalkSpeed = plr.Character.Humanoid.WalkSpeed + 100
    end
end)

Your issue was due to a syntax error. I removed a duplicate PlayerAdded and fixed the syntax error in your script, and it should work fine now. Also, LocalPlayer doesn't work on the server and you used it instead of the defined variable "plr". Make sure this script is inside of ServerScriptService!

Let me know if this script doesn't work down in the comments!

(You should also put a code block into your original post next time.)

Yes you can create a script to increase a player's WalkSpeed if they own a certain game-pass.

Here is a basic script for it.

local passId = 5778889
local MarketplaceService = game:GetService("MarketplaceService")game:GetService("Players").PlayerAdded:connect(function(Player)
    if MarketplaceService:UserOwnsGamePassAsync(Player.UserId,passId) then
	    --your code to increase walkspeed
    end
end)

P.S. Do not use GamePassService, it is deprecated.

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