--This is something very accurate, so if you're Minitoon, You can just ask me to delete it if you want.

wait(1)
local TweenService = game:GetService("TweenService") --gets service for tween
local tweenPart = game.Players.LocalPlayer.Character.Humanoid --the part you want to tween (you can change this)

local info = TweenInfo.new(
    0.325,           --seconds it takes to complete loop
    Enum.EasingStyle.Back,     --easingstyle (how it moves)
    Enum.EasingDirection.Out,    --easingdirection (which direction)
    0,                    --times repeated (negative number if u want infinite)
    false,                 --reverse (does it go back to its spot)
    0                      --delay time (stoptime before doing the tween)
)

local Goals = {             --YOU CAN CHANGE THESE AND DELETE THE THINGS YOU DON'T WANT TO TWEEN
    CameraOffset = Vector3.new(0,-1.5,0), --where the part will be after tween
}
local info2 = TweenInfo.new(
    0.3,           --seconds it takes to complete loop
    Enum.EasingStyle.Back,     --easingstyle (how it moves)
    Enum.EasingDirection.Out,    --easingdirection (which direction)
    0,                    --times repeated (negative number if u want infinite)
    false,                 --reverse (does it go back to its spot)
    0                      --delay time (stoptime before doing the tween)
)

local Goals2 = {             --YOU CAN CHANGE THESE AND DELETE THE THINGS YOU DON'T WANT TO TWEEN
    CameraOffset = Vector3.new(0,0,0), --where the part will be after tween
}

local PartTween = TweenService:Create(tweenPart, info, Goals) --gets all the info and goals and creates tween
local PartTween2 = TweenService:Create(tweenPart, info2, Goals2) --gets all the info and goals and creates tween

local animidle = tweenPart:LoadAnimation(script.Parent.Idle)

local animwalk = tweenPart:LoadAnimation(script.Parent.Walk)
local crouching = false
local waiting = false

local userinputservice = game:GetService("UserInputService")
userinputservice.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.LeftControl then
        if waiting == false then
            if crouching == false then
				script.Parent.ImageColor3 = Color3.new(1, 1, 1)
				script.Parent.Parent.ImageColor3 = Color3.new(0, 0.666667, 1)
                tweenPart.WalkSpeed = 8
                waiting = true
                crouching = true
                animidle:Play()
                PartTween:Play() --plays it
                tweenPart.Running:Connect(function(Speed)
                    if crouching == true then
                        if Speed >= 1 then
                            animidle:Stop()
                            if animwalk.IsPlaying == false then
                                animwalk:Play()
                            end

                        else
                            animidle:Play()
                            animwalk:Stop()
                        end
                    end
                end)
                wait(0.05)
                waiting = false
            else
				script.Parent.ImageColor3 = Color3.new(0, 0, 0)
				script.Parent.Parent.ImageColor3 = Color3.fromRGB(135, 135, 135)
                tweenPart.WalkSpeed = 16
                waiting = true
                crouching = false
                animidle:Stop()
                animwalk:Stop()
                PartTween2:Play()
                wait(0.05)
                waiting = false
            end
        end

    end
    if input.KeyCode == Enum.KeyCode.LeftShift then
        if waiting == false then
            if crouching == false then
				script.Parent.ImageColor3 = Color3.new(1, 1, 1)
				script.Parent.Parent.ImageColor3 = Color3.new(0, 0.666667, 1)
                tweenPart.WalkSpeed = 8
                waiting = true
                crouching = true
                animidle:Play()
                PartTween:Play() --plays it
                tweenPart.Running:Connect(function(Speed)
                    if crouching == true then
                        if Speed >= 1 then
                            animidle:Stop()
                            if animwalk.IsPlaying == false then
                                animwalk:Play()
                            end

                        else
                            animidle:Play()
                            animwalk:Stop()
                        end
                    end
                end)
                wait(0.05)
                waiting = false
            else
				script.Parent.ImageColor3 = Color3.new(0, 0, 0)
				script.Parent.Parent.ImageColor3 = Color3.fromRGB(135, 135, 135)
                tweenPart.WalkSpeed = 16
                waiting = true
                crouching = false
                animidle:Stop()
                animwalk:Stop()
                PartTween2:Play()
                wait(0.05)
                waiting = false
            end
        end

    end
end)
script.Parent.MouseButton1Click:Connect(function()
    if waiting == false then
        if crouching == false then
			script.Parent.ImageColor3 = Color3.new(1, 1, 1)
			script.Parent.Parent.ImageColor3 = Color3.new(0, 0.666667, 1)
            tweenPart.WalkSpeed = 8
            waiting = true
            crouching = true
            animidle:Play()
            PartTween:Play() --plays it
            tweenPart.Running:Connect(function(Speed)
                if crouching == true then
                    if Speed >= 1 then
                        animidle:Stop()
                        if animwalk.IsPlaying == false then
                            animwalk:Play()
                        end

                    else
                        animidle:Play()
                        animwalk:Stop()
                    end
                end
            end)
            wait(0.05)
            waiting = false
        else
			script.Parent.ImageColor3 = Color3.new(0, 0, 0)
			script.Parent.Parent.ImageColor3 = Color3.fromRGB(135, 135, 135)
            tweenPart.WalkSpeed = 16
            waiting = true
            crouching = false
            animidle:Stop()
            animwalk:Stop()
            PartTween2:Play()
            wait(0.05)
            waiting = false
        end
    end
end)