You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
"I want to fix this annoying bug where, when I’m running and I start sliding, the animation gets glitched. The same issue occurs when I press the Esc key. - What is the issue? Include screenshots / videos if possible!
Case A(When I click Esc while Running):
Case BWhen I’m running and then slide, I keep holding down the ‘R’ key while sliding. However, when the slide animation finishes, I release the ‘R’ key.):
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yea I tried to find a solution inside the DeveloperForum but I couldn’t find something.
function KeyCodeModuleScript:LoadSmoothAnimation(animation, shouldPlay, seconds)
if SlideCooldown == true then return end
print("LoadSmoothAnimation was called", animation, "shouldPlay:", shouldPlay)
local currentAnimTrack = Animator:LoadAnimation(animation)
local transitionTime = 1.5
if shouldPlay == true then
print("Starting Animation")
currentAnimTrack:Play(transitionTime, 0)
currentAnimTrack:AdjustWeight(1, 0.5)
currentAnimationTrack = currentAnimTrack
else
if shouldPlay == false then
print("Stopping Animation")
currentAnimationTrack:AdjustWeight(0.5, 1)
currentAnimationTrack:Stop(transitionTime, 0)
currentAnimationTrack = nil
end
end
if seconds ~= nil then
local value = KeyCodeModuleScript.HipHeight
print("Starting Animation with timer")
currentAnimTrack:Play(transitionTime, 0)
currentAnimTrack:AdjustWeight(1, 0.5)
currentAnimationTrack = currentAnimTrack
Humanoid.AutoRotate = false
Humanoid.HipHeight = 0.8
shouldMove = true
task.spawn(function()
moveInDirection(2.5, 50)
task.wait(5)
SlideCooldown = false
end)
Signal.FireServer("KeyCodeModuleScript:VFX", Character, value)
task.wait(2.5)
currentAnimTrack:AdjustWeight(0.5, 1)
SlideCooldown = true
currentAnimTrack:Stop(0.5, 0)
Humanoid.AutoRotate = true
Humanoid.HipHeight = value
currentAnimationTrack = nil
end
end
function KeyCodeModuleScript:PerformMovements(Keys, Type)
print("Key:", Keys, "Type:", Type)
if Keys == "ValueR" and Type == "InputBegan" then
self:LoadSmoothAnimation(runAnimation, true, nil)
startSprint()
elseif Keys == "ValueR" and Type == "InputEnded" then
stopSprint()
self:LoadSmoothAnimation(runAnimation, false, nil)
elseif Keys == "ValueC" and Type == "InputBegan" and Humanoid:GetState() ~= (Enum.HumanoidStateType.FallingDown and Enum.HumanoidStateType.Freefall) then
self:LoadSmoothAnimation(slideAnimation, true, 2)
if isSprinting then
stopSprint()
end
elseif Keys == "OtherValue" then
end
end