Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Passing Multiple parameters into a function when using the ,Touched function?

Asked by 6 years ago
Edited 6 years ago

OK so I have a working code but because it is a touched function I used three separate functions with only one difference. The code basically changes a players team when they walk through a wall.

so here is the main thing I write:

function heyo(hit) 

end                                                                     example.Touched:connect(heyo)

Obviously, that code wouldn't do anything but the question is what do I change in the call and functions statement to make it so that I can send a second parameter into the function (since hit is already being sent)

1 answer

Log in to vote
0
Answered by
Nonaz_jr 439 Moderation Voter
6 years ago
local secondParam = "Whatever you wanna send"

function heyo(hit, param2) 
    print(param2)
end                                  

example.Touched:connect(function(hit)
    heyo(hit, secondParam)
end)
0
Thanks Nonaz_jr That is the perfect solution to my problem!! JayQwery 0 — 6y
Ad

Answer this question