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)
There are some errors here.
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
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
.