The title is self-explanatory. The script is unable to detect movement when I change my character to a custom character. It does, however, detect on a normal character.
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)
while true do
wait()
humanoid.Running:Connect(function(speed)
if speed > 0 then
print("speed is bigger than 0")
if not walkAnimTrack.IsPlaying then
print("the anim track is not playing")
walkAnimTrack:Play()
end
else
print("player not moving")
if walkAnimTrack.IsPlaying then
walkAnimTrack:Stop()
end
end
end)
end
You do not need to wrap your running connection in a while true do, because it’ll automatically fire when humanoid is running:
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)
humanoid.Running:Connect(function(speed)
if speed > 0 then
print("speed is bigger than 0")
if not walkAnimTrack.IsPlaying then
print("the anim track is not playing")
walkAnimTrack:Play()
end
else
print("player not moving")
if walkAnimTrack.IsPlaying then
walkAnimTrack:Stop()
end
end
end)
end
If it still doesn’t work, which it should, let us know.