generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Quick Question

Previous Thread :: Next Thread 
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
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
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
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
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
17 Jul 2011 05:43 PM
@Dingdong272

Shouldn't it be:

block.Touched:connect(_G.myGlobalFunc)

???
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image