local char = script.Parent local hum = char:WaitForChild("Humanoid") local animator = hum:WaitForChild("Animator") local animate = char:WaitForChild("Animate") local ui = game:GetService("UserInputService") local crawlin = false ui.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift and crawlin == false then crawlin = true hum.WalkSpeed = 10 hum.JumpPower = 25 animate.walk.WalkAnim.AnimationId = "rbxassetid://10912465913" --action priority animate.idle.Animation1.AnimationId = "rbxassetid://10918439489" --idle priority animate.idle.Animation2.AnimationId = "rbxassetid://10918439489" --idle priority elseif input.KeyCode == Enum.KeyCode.LeftShift and crawlin == true then crawlin = false hum.WalkSpeed = 16 hum.JumpPower = 50 animate.walk.WalkAnim.AnimationId = "rbxassetid://180426354" --action priority animate.idle.Animation1.AnimationId = "rbxassetid://180435571" --idle priority animate.idle.Animation2.AnimationId = "rbxassetid://180435792" --idle priority end end)
While it does work, there's a slight issue. When "Shift" is pressed, the animation doesn't play instantly until the player moves. In addition, if the player is walking and pressed shift, the animation wouldn't work until they have stopped. Same thing happens when the player is crawling and presses shift. I want my crawl to look like the one in Flee The Facility on Roblox if it helps, any help is appreciated!
Changing the animate script of the character itself is really bad, simply play an animation over them (higher priority) Use input
local uis = game:GetService("UserInputService) local function CheckKeyDown() --check key down end local function CheckKeyUp() --check key up end uis.InputBegan:Connect(CheckKeyDown) uis.InputEnded:Connect(CheckKeyUp)