Am i not using task.spawn() correctly?

I have a piece of code that is supposed to run 2 functions at the same time. I used task.spawn() to try and run these two functions but only the top one runs. (dont worry about the while loops being empty, the code i have works fine, but it seems like threads are off or something)

function headtailSequence()
	local headlight = car.Body.Headlight.G1
	local tweeninfo = TweenInfo.new(0.25, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)
	while switched do
	end
end

function sequence()
	local iterations = 0
	local sequence_num = 1
	while switched do
    end
end
F.Switch = function(s)
	switched = s
	if s then
		task.spawn(headtailSequence())
		task.spawn(sequence())
	end
end

when the F.Switch functon is called it is supposed to make both sequences happen at the same time, but when testing it in studio, it doesn’t work.

You’re calling the functions by keeping extra ()s at the end instead of passing them to the task.spawn function, remove them to pass them properly.

task.spawn(headtailSequence)
task.spawn(sequence)

thank you, this worked for what i needed.