I want to make a Hold-Down to crouch script, and everything is working perfectly fine. The thing is that I’m going for a retro/blocky animation style in my game, and so I need the FadeOut to be 0. I made a crouching script with a start-up animation and the looping one. Very self explanatory.
My issue is that when I try to make FadeOut of the animation to 0, the start-up animation is instantly skipped and the looping animation plays immediately.
I didn’t find anything related to my issue so I decided to post
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
repeat wait() until player.Character
char = player.Character
hum = char:FindFirstChild("Humanoid")
hrp = char:FindFirstChild("HumanoidRootPart")
local Animator = hum:WaitForChild("Animator")
local animationFolder = game:GetService("ReplicatedStorage")["DIO animations"]
local crouchStartUp = Animator:LoadAnimation(animationFolder.CrouchStartUp)
local crouch = Animator:LoadAnimation(animationFolder.Crouch)
local deb = false
crouch.Priority = Enum.AnimationPriority.Action4
local uis = game:GetService("UserInputService")
uis.InputBegan:connect(function(key, gameProcessed)
if key.KeyCode == Enum.KeyCode.LeftControl and gameProcessed == false then
hum.WalkSpeed = 0
crouchStartUp:Play(0)
if crouchStartUp.Stopped then
crouchStartUp:Stop()
crouch:Play(0)
end
end
end)
uis.InputEnded:connect(function(key, gameProcessed)
if key.KeyCode == Enum.KeyCode.LeftControl and gameProcessed == false then
hum.WalkSpeed = 16
crouch:Stop()
if crouch.Stopped then
crouchStartUp:Play(-1)
if crouchStartUp.Stopped then
crouchStartUp:Stop()
end
end
end
end)