im trying to make it so when you have nine items you cant move but it wont work. it is a local script and is in starter player scripts.
the code is
local p = game.Players.LocalPlayer
while wait() do
if p.Backpack:GetChildren() > 9 then
p.Humanoid.WalkSpeed = 0
else
p.Humanoid.Walkspeed = 16
end
end
There are a few flaws in your script, but ignoring those flaws here is how you do it:
local p = game.Players.LocalPlayer
while wait() do
local tools = p.Backpack:GetChildren()
if #tools >= 9 then
p.Humanoid.WalkSpeed = 0
else
p.Humanoid.Walkspeed = 16
end
end