|
| 17 Jul 2011 05:27 PM |
Could you use onTouch in global functions...
function _G.ex(Connection) enabled = true function onTouch(hit) if not enabled then return end enabled = false if hit.Parent:findFirstChild("Humanoid") == nil then enabled = true else -- code for function end end Connection:connect(onTouch) end |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2011 05:28 PM |
yes, quick example:
_G.myGlobalFunc = function(part) if part.Parent.Torso then part.Parent.Torso:Remove() end end
_________ in another script:
block.Touched:connect(myGlobalFunc) |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2011 05:43 PM |
@Dingdong272
Shouldn't it be:
block.Touched:connect(_G.myGlobalFunc)
??? |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2011 07:20 PM |
You could, but it works either way. It's kind of like this:
table = { g = function() print("g") }
func = table[1]
func()
or:
table[1]() |
|
|
| Report Abuse |
|
|