How to make one function override the other

local function A()
	print("A")
	wait(1)
end

local function B()
	print("B")
	wait(5)
end

--What this is doing is ABABAB with 5 seconds cooldown after B before printing A
while wait(0.1) do
	A()
	B()
end

--And I want to print
AAAABAAAAB
--Or if Function B has a cooldown of 4 then it will print
AAABAAAB
1 Like
local function A()
	print("A")
	wait(1)
end

local function B()
	print("B")
	wait(5)
end

while wait(0.1)do
	for Count = 1, 4 do
		A()
	end
	B()
end

Also this one if you want to change the function patern using their wait time.

local A_Ready = true
local B_Ready = true

local function A()	
	if A_Ready == true then
		A_Ready = false
		print("A")
		wait(1)
		A_Ready = true
	end		
end

local function B()
	if B_Ready == true then
		B_Ready = false
		print("B")
		wait(5)
		B_Ready = true
	end	
end

while wait(1) do
	coroutine.resume(coroutine.create(function()
		A()
		B()
	end))
end
4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.