I recently made this crouch script, and it all seems to be working fine (havn’t implemented crouch walking anim yet), but when standing up, the player’s walk animation gets “smaller”, its kinda hard to explain, and I am not very able to send a video, but basically, the player moves it’s arms, legs, and every other body part at a less intense rate then at the start.
You have the both animations playing, while theyre on the same animation track, which causes animation overlap. To fix this, you can either reupload the animations on a differnt track, or stop the animations when they arent needed anymore.
Also this line here, would make you only be able to have the crouch animation play around 256 times.
I would recommend loading the animation in a table, and then replacing that line with
You only need to load each animation object once (via LoadAnimation).You’re currently loading multiple animation track objects from the same animation object resulting in the overlap.
I am now loading the animations and then just playing (and stopping) them, still seems to have a similar problem tho
---Animations---
local crouchAnim = Instance.new("Animation")
local startCrouchAnim = Instance.new("Animation")
crouchAnim.AnimationId = 'rbxassetid://10798717676'
startCrouchAnim.AnimationId = 'rbxassetid://10798520553'
---Loaded Animations---
local crouchAnimTrack = animator:LoadAnimation(crouchAnim)
local startCrouchAnimTrack = animator:LoadAnimation(startCrouchAnim)
local defaultIdleAnimTrack = animator:LoadAnimation(idle)
---Crouch---
uis.InputBegan:Connect(function(inp)
if inp.KeyCode == Enum.KeyCode.Z then
if crouching then
crouchAnimTrack:Stop()
startCrouchAnimTrack:Play(0.1, 1, -1)
crouching = false
humanoid.WalkSpeed *= 2
startCrouchAnimTrack.Stopped:Wait()
idle.AnimationId = 'rbxassetid://507766388'
defaultIdleAnimTrack:Play()
run.AnimationId = 'rbxassetid://913376220'
else
defaultIdleAnimTrack:Stop()
startCrouchAnimTrack:Play()
crouching = true
humanoid.WalkSpeed /= 2
startCrouchAnimTrack.Stopped:Wait()
idle.AnimationId = 'rbxassetid://10798717676'
crouchAnimTrack:Play()
run.AnimationId = 'rbxassetid://10798552591'
end
end
end)
Also, for whatever reason, the run animation does not overpower the idle animation even though it has the priority of movement (i think I even set it to action just in case), while the idle having a priority of idle, is this because im playing it in a seperate script?