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

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

Asked by 5 years ago

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)

0
This is not a request site. darkhenry 93 — 5y
0
He is not making a request. He is showing code that he is trying to fix. namespace25 594 — 5y
0
in function isAuthenticated(player) return game:GetService(“GamePassService”):PlayerHasPass(player, passId) end. You just defined a function, but never actually ran it. wwwdanielwww 5 — 5y

2 answers

Log in to vote
0
Answered by
popeeyy 493 Moderation Voter
5 years ago
Edited 5 years ago
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.)

Ad
Log in to vote
0
Answered by 5 years ago

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.

Answer this question