I know you can call a function below in this touched example:
function myFunction()
print("Function ran")
end
part.Touched:Connect(myFunction)
Would I be “calling” the function in the event or “referencing/passing” the function in the event?
.
Because when you call a function normally, you would include brackets “()” like this:
function myFunction()
print("Function ran")
end
myFunction() --calling the function
.
But doing that inside an event results in an error:
function myFunction()
print("Function ran")
end
part.Touched:Connect(myFunction()) --attempt to connect failed: passed value is not a function
.
.
I tried searching online and I found this comparison example, is this accurate?
“Calling the function is like firing the gun. Passing it is like giving the gun to the next person and let them decide if they want to shoot it and how”
Sorry about the formatting as this is my first post.