I do get print messages saying that it has sent the request to play and stop the Animation Track. However, the player's character doesn't react to the request whatsoever.

This script is in StarterPlayer.StarterCharacterScripts and the uploaded Animation Priority is 'Action' with loop off.

local crawlanim=Instance.new("Animation",script)
crawlanim.AnimationId="http://www.roblox.com/asset/?id=1012781669"

local char = game:GetService("Players").LocalPlayer.Character
local humanoid = char:WaitForChild("Humanoid")
repeat wait() until humanoid.Parent.Parent.Name=="Workspace"

local animTrack = humanoid:LoadAnimation(crawlanim)

local uis=game:GetService("UserInputService")

function onKeyPress(play, inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.LeftShift then
		if play==true then
			print("play")
			animTrack:Play()
		else
			print("stop")
			animTrack:Stop()
		end 
	end
end
 
game:GetService("UserInputService").InputBegan:connect(function(...) onKeyPress(true,...) end)
game:GetService("UserInputService").InputEnded:connect(function(...) onKeyPress(false,...) end)

1 comment

0

Modify the original animation script. Depending on the circumstances, the default walking animation may have a higher priority than your crawling animation.