How to Find Players Current Walkspeed when Touching a Part

Cant seem to find the players current walkspeed when they touch a part keeps saying cant index with nil walkspeed

local Model = script.Parent

local MainGlass = script.Parent.MainGlass

local BrokenGlass = script.Parent.BrokenGlasses

local debounce = false

local ModelClone = Model:Clone()

ModelClone.Parent = game.ReplicatedStorage

function onTouched(hit)

local human = hit.Parent:findFirstChild(“Humanoid”)

if human.WalkSpeed < 60 then

print(“Fast Enough To Break”)

else

print(“Not Fast Enough Gain more Speed”)

end

end

script.Parent.MainGlass.Touched:Connect(onTouched)

1 Like

The local human is returning a nil value. The human variable can’t find the humanoid because the the parent is nil. Your syntax for the FindFirstChild might be wrong. You can try correcting the syntax.

hit.Parent:FindFirstChild(“Humanoid”)

I fixed my FindFirstChild it can find the Humanoid, it cant find its Walkspeed it returns a nil value