Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i activate or run a function without using events?

How do i activate a function without using events?

For example i have this.

local function A()
	--random codes
end)

local function B()
	--random codes
end)

Now, How do i make it so that when the function "A" activates, It will activate function "B".

local function A()
	--random codes

	--a code that runs or activate function B
end)

local function B()
	--random codes
end)

But, I don't wanna use something like this.

Script.Parent.Touched:Connect(B)
Script.Parent.Changed:Connect(B)

P.S if it's not possible or i'm just bad at explaining please don't dislike just tell me in the comment.

1 answer

✓ Accepted answer

To call a function, you can simply say the functions name, followed by a set of parentheses.

Here is how you would fulfill your request:

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

local function A()
	print("A")
	B() --call function B
end)

A() -- call function A

2 comments

0

Thanks amanda :)

0

Sure, let me know if you have more questions.

This discussion is preserved as it was. New answers, comments, and votes are closed.