while is always ‘true’ which causes it to crash since it is infinitely looping. You will need a condition that will make the while loop false at a certain point so it will stop infinitely looping.
Maybe you mean something like:
Cooldown = true
spawn(function()
wait(1)
while Cooldown == true do
if Cooldown then
Cooldown = false
end
end
end)