Basically I click C and it kinda bobs, what is meant to happen is it toggles, so I click c once and it crouches, then I tap it again and it uncrouches, what is happening?

local UIS = game:GetService("UserInputService")

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Animator = Character:WaitForChild("Humanoid")

local isCrouching = false

local IdleAnim

UIS.InputBegan:Connect(function(Input, Chatted)
	if not Chatted then 
		if Input.KeyCode == Enum.KeyCode.C then
	 		if isCrouching == false then 
				print("Crouching")
				IdleAnim = Animator:LoadAnimation(script:WaitForChild("Animation"))
				isCrouching = true
				IdleAnim:Play()
			else
				print("Not Crouching")
				isCrouching = false
				IdleAnim:Stop()
			end
	end
	end
end)


Here is a video of what is happening with console print statements: https://streamable.com/badz6t

1 comment

0

I fixed it by changign the animations