WalkSpeed not setting

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
	if game.MarketplaceService:PlayerOwnsAsset(player,8522737) or table.find(Friends,player.UserId) then
			local Humanoid = character:WaitForChild("Humanoid")
			if Humanoid then
			Humanoid.WalkSpeed = 21
			end
		end
	end)
end)

No errors, No nothin’ any clue why this is happening?

1 Like

Add a print before the local Humanoid line to see if it’s getting through. Before anything, do you actually own the asset with the id 8522737 or your userid is in that table?

I own the game, so I have the gamepass, i’ll print it give me a sec

Try this one:

game.Players.ChildAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		if game.MarketplaceService:UserOwnsGamePassAsync(player.UserId, 8522737) or table.find(Friends,player.UserId) then
			local h = char:WaitForChild('Humanoid')
			h.WalkSpeed = 32
		end
	end)
end)

And you used MarketplaceService:PlayerOwnsAsset. That does’t check if you own a gamepass.

Gamepass?? Use UserOwnsGamePassAsync(player.UserId,8522737) for that, it doesn’t work with that

try this
character.Humanoid.WalkSpeed = 21

Doesn’t work because you had 2 ors, and it’s more ideal to only connect the event if they own it first to redue unneeded event connections

local mps = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
	
	if mps:UserOwnsGamePassAsync(player.UserId, 8522737) or table.find(Friends,player.UserId) then
		player.CharacterAdded:Connect(function(char)
			local h = char:WaitForChild('Humanoid')
			h.WalkSpeed = 21
		end)	
	end
end)

That’s weird? I have this and it works

if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,8522737) or table.find(Friends,player.UserId) then
			wait(2)
			if character.Head:FindFirstChild("DeveloperGUI") then
					
				else
			local clonedgui = billboardgui:Clone()
			clonedgui.TextLabel.Text = "Premium"
			clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0,85,255)
			clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
			end
		end
	end)

It’s basically an overhead gui for people who have the gamepass, it works fine?
I’m about to try userOwnsGamePassAsync

Oh, I didnt saw there were 2 or.

@gizziboy do this
character.Humanoid.WalkSpeed = 50

Yup it works, thanks for the help

1 Like

You’re really not helping at all, Walkspeed isn’t changing anyways so this isn’t going to do anything.

You can avoid most of this by simply doing;

game.Players.PlayerAdded:Connect(function(player)
	if game.MarketplaceService:PlayerOwnsAsset(player,8522737) or table.find(Friends,player.UserId) then
			local Humanoid = player.Character:WaitForChild("Humanoid")
			    if Humanoid then
			        Humanoid.WalkSpeed = 21
			    end
		end
end)

Or doing it this way;

game.Players.PlayerAdded:Connect(function(player)

     if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 8522737) or table.find(Friends,player.UserId) then
      
     player.Character:FindFirstChild("Humanoid").WalkSpeed = 21

     end

end)

But I do have to agree with UserOwnsGamePassAsync being the way to go since it’s a GamePass

That’s only going to work once since there’s no CharacterAdded event, meaning after a respawn they wont have their walkspeed set again

1 Like