Hi guys,
I have a charging jump function that begins on InputBegan (Space).
If the time between when the player presses space and releases it, is greater than 1 second than they jump higher.
I am including this information in this post because I am trying to create an animation for the player charging the jump.
However, it seems that when I attempt to play this animation inside of the code, a different animation begins playing; and it seems to be the freefall animation.
https://gyazo.com/71c609bfa1a7356330c5e8ebea9844df
I believe that the Jump is attempting to play on InputBegan; but since I have coded around this, it goes straight to the Freefall Animation instead.
Basically what I am asking; is if there is a way to make my Charging Animation play over the Freefall animation which is currently playing.
I have tried setting my Charge animation to Action priority already, as I thought that may work; but it has not helped.
For reference, here is my Charging Jump Code (incase it may be an issue with that):
Summary
UIS.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.Space then
humanoid.JumpPower = 0
if chargeAcknowledged == false then
chargeAcknowledged = true
lastCharge = os.clock()
if humanoid.MoveDirection.Magnitude > 0 then
print("moving")
else
print("not moving")
PlayCharge:Play()
end
end
end
end)
local timeCheck
UIS.InputEnded:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.Space and (StateTracker.State == "onRunning" or StateTracker.State == "onGravityWalk") then
chargeAcknowledged = false
timeCheck = os.clock() - lastCharge
print(timeCheck)
if timeCheck >= 1 then
humanoid.JumpPower = 100
elseif timeCheck < 1 then
humanoid.JumpPower = 50
end
if humanoid.JumpPower == 50 then
HRP.Velocity = HRP.CFrame.UpVector * 50
PlayJump:Play()
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
humanoid.Jump = true
elseif humanoid.JumpPower == 100 then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
PlayJump:Play()
HRP.Velocity = HRP.CFrame.UpVector * 100
humanoid.Jump = true
end
elseif input.KeyCode == Enum.KeyCode.Space and (StateTracker.State ~= "onRunning" or StateTracker.State ~= "onGravityWalk") then
chargeAcknowledged = false
end
end)