Spawn function requires 1 argument

I keep getting the error “Spawn function requires 1 argument”. How can I fix this? Screenshot of the code:
image

2 Likes

What is f1?? if f1 is a function you need to call like this:

spawn(function() 
   f1(hit.v) 
end)

'cause you are really calling the function when you it isn’t been called & spawn function receives only a function, not function called. (test it)

3 Likes

Don’t use spawn function like that, If the function has no parameters then you can use this

spawn(f1)

else, use

spawn(function() 
   f1(hit, v) 
end)
3 Likes

Thanks @MrAtom_Official and @BirdieI90. My console can finally be free from all the errors (the spawn function still worked but it printed a lot of errors)!

2 Likes

If a function is already defined you may as well use the spawn(f1, hit, v) idiom instead. I’d also recommend using task.spawn.

3 Likes