DasKairo
(Cairo)
March 2, 2023, 3:29pm
#1
Small Questions I have on Setting up Connections (or Events), However, this question may just be up to Personal Prefrence so I’m not sure.
But what would be the better way of doing this, so for Example, I have a Part that when touched, will do something, should I set it up like this:
BasePart.Touched:Connect(function(otherPart)
print(otherPart)
end)
or like this:
function OnTouch(otherPart)
print(otherPart)
end
BasePart.Touched:Connect(OnTouch)
But Again, this just may be up to Personal Prefrence, So not sure.
But what should I be doing?
keremMCT
(NETSTAL)
March 2, 2023, 3:33pm
#2
If you use a function multiple times, make a function for it with the second preference
If only once, create the function as you connect it with first preference
Personally I like the first one:
BasePart.Touched:Connect(function(otherPart)
print(otherPart)
end)
because i easily understand what functions are inside that functions such as:
Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function)
end)
end)
Again, its’s up to preference and your choice. there is not much of a difference in general such as perfomance or anything that affects game-wise
system
(system)
Closed
March 16, 2023, 3:42pm
#4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.