So I've made a little piece of code to toggle between equipping and unequipping a sword. it's in a local script, and anything mentioned is already defined.

local swordReady = true
local swordOn = false
function ToggleEquipSword()
	if not swordReady then return end
	swordReady = false
	if not swordOn then
		print('Equip sword')
		swordOn = true
	else
		print('Unequip sword')
		swordOn = false
	end
	wait(1/10)
	swordReady = true
end

contextAction:BindActionToInputTypes('ToggleEquip',ToggleEquipSword,false,Enum.KeyCode.One)

So, things work fine. The output still has prints when I press 1 on my keyboard. However, it also says:

  • ContextActionService::InvokeCallback failed because Callbacks cannot yield

I don't know what this means and I don't know if it will interfere with later parts of the script.