|
| 29 Aug 2015 11:25 PM |
| Like at the end of one script tell another script to start running |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 11:28 PM |
function mycustomfunction() -- script end
script.Parent.Touched:connect(function() mycustomfunction() end) |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 11:28 PM |
function MakePoop(Food) for i,v in pairs(Stomach:GetChildren()) do v:Digest() v:Poop() end end |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 11:31 PM |
| Can someone explain it more clearly? I don't really get what the first two people are saying. To be clear, I want one script to say something like "Start Test Function" an another script to be like "function on Test Started" |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 29 Aug 2015 11:32 PM |
'Like at the end of one script tell another script to start running' Just do otherScript.Disabled = false? |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 11:34 PM |
to create a function: function YourFunction(Arguments)
end
to call a function: YourFunction(Arguments)
Arguments are information given to the function when the function is called. For instance:
function PrintName(Name) print(Name) end
PrintName(game.Workspace.Swag)
results in:
"Swag"
|
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 11:35 PM |
| Read the Roblox wiki's page on functions. http://wiki.roblox.com/index.php?title=Function |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 11:36 PM |
Alright.
function YourFunctionName() -- This is the function, inorder for it to do whatever -- code you have inside it it needs to be fired. game.Workspace.Part.BrickColor = BrickColor.new("Bright red")-- Whatever you want --to put in it end--end the function
Now when you want to change the parts color to red, you need to fire the function, its done like this
YourFunctionName()-- Thats it! if you wanted to fire it when a part is touched you would do
game.Workspace.Part.Touched:connect(YourFunctionName) |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 11:38 PM |
I kinda get it, but I still can't get it to work
Script 1:
.....(other stuff).... OddChange(Change) ....(other stuff)....
Script 2:
function OddChange (Change) stuff end
|
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 30 Aug 2015 12:10 AM |
| Functions can't communicate between scripts. You'll want to look into RemoteFunctions, but only after you've gained a solid understanding of the basics of RBX.Lua. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 30 Aug 2015 12:40 AM |
| Well, they can but it's not ideal. |
|
|
| Report Abuse |
|
|