Hey!
Imagine you have a touched event (or something else) but you have to pass the hit and the name of the baseplate to it (for whatever reason), how would you do it?
I would think of this:
local function touch(hit, name)
print(hit.Parent.Name .. " touched " .. name)
end
workspace.Baseplate.Touched:Connect(function(hit)
touch(hit, workspace.Baseplate.Name)
end)
But isn’t there a way where you could do something like this
local function touch(hit, name)
print(hit.Parent.Name .. " touched " .. name)
end
workspace.Baseplate.Touched:Connect(touch(workspace.Baseplate.Name)) --Hit automatically gets passed as first arg
This would obviously be better performance-wise and save one extra undeclared function.
My example might not be the best but you probably get what I mean.
Thanks!