so i made this slide script. but everytime im done sliding it changes my walkanimation into this weard fastwalk.
this is my script but i dont think it has anything to do with it.
local humanoid = script.Parent:WaitForChild("Humanoid")
local anim = humanoid:LoadAnimation(script:WaitForChild("SlideAnimation"))
local uis = game:GetService("UserInputService")
local isKeyPressed = false
local keyPressTime = 0
local minKeyPressDuration = 0.5 -- in seconds
local maxKeyPressDuration = 1 -- in seconds
uis.InputBegan:Connect(function(inp, processed)
if processed then return end
if inp.KeyCode == Enum.KeyCode.LeftControl then
isKeyPressed = true
keyPressTime = tick()
anim:Play()
humanoid.HipHeight = 0.3
coroutine.wrap(function()
while isKeyPressed do
local elapsed = tick() - keyPressTime
if elapsed >= maxKeyPressDuration then
anim:Stop()
humanoid.HipHeight = 2
isKeyPressed = false
break
end
wait()
end
end)()
end
end)
uis.InputEnded:Connect(function(inp)
if inp.KeyCode == Enum.KeyCode.LeftControl then
isKeyPressed = false
local elapsed = tick() - keyPressTime
if elapsed < minKeyPressDuration then
wait(minKeyPressDuration - elapsed) -- Wait for the remaining time
end
anim:Stop()
humanoid.HipHeight = 2
end
end)
video:
[Edit]: i found out that its coused by changing the HipHeight of the humanoid, but i still cant find a way t o fix it