Problem with player walkspeed

here is my code

local speedGamepass = 22330083
local VipGamepass = 22467991
local mpService = game:GetService("MarketplaceService")


game.Players.PlayerAdded:Connect(function(player)
	if mpService:UserOwnsGamePassAsync(player.UserId, speedGamepass) then
		local char = player.CharacterAdded:wait()
		
		local thing = char:WaitForChild("Humanoid")
		
		if thing then
			thing.Walkspeed = 35
		
		end
		
		
        end        
end)

the error - image
How do I fix this?

Humanoid’s WalkSpeed property should have the “S” capitalized, “Walkspeed” doesn’t exist.

You may also want to consider a pcall around “UserOwnsGamePassAsync”, as that call can sometimes throw an error if Roblox’s services fail. However, this isn’t your current issue.

1 Like

Thanks and also where should I put the pcall at

You’d want to wrap UserOwnsGamePassAsync with a pcall. There’s a few ways to do this, but I personally often use this strategy due to preference:

local hasPass = false
local success, message = pcall(function()
	hasPass = mpService:UserOwnsGamePassAsync(player.UserId, speedGamepass)
end)

From here you’d use hasPass (if it was true) to make the player fast. You’d likely also want to have this pcall retry until it succeeds - as if it errors it’ll just default to the player not having the gamepass.

Thanks :)))))) It really helps

1 Like