The problem is how you load the humanoid, is waiting forever.
How do i load the humanoid correctly ?
Made some changes for you, I think will work, if you hold left control when firing. Please remember to replace the entire code.
local userInputService = game:GetService("UserInputService")
local isEquipped = true
local crouching = false
userInputService.InputBegan:Connect(function(input)
print("Hello")
if input.KeyCode == Enum.KeyCode.LeftControl and isEquipped == true then
print("Fire")
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://16706440839"
local track
track = script.Parent.Parent.Humanoid:LoadAnimation(Anim)
track.Priority = Enum.AnimationPriority.Action4
track.Looped = false
if crouching == true then
crouching = false
script.Parent.Parent.Humanoid.WalkSpeed = 16
track:Stop()
else
script.Parent.Parent.Humanoid.WalkSpeed = 4
crouching = true
track:Play()
task.wait(track.Length * 0.98)
track:AdjustSpeed(0)
end
end
end)
Thank you! It started working finally, it was the loading of the humanoid right?
Yes, was waiting forever for the humanoid.
oh, i wouldve thought it would have given me an infinite yield
Yeah, it should. I don’t know why this time studio was silent.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.