I am learning to script and I have a question..
#1
So if a tool had a fly script in it, I'd be the child and the tool would be the parent? :O
Reply
#2
This should be in the scripter's section.
Reply
#3
Let's say you have a script inside of a box.

Box
VV
Script

The scripts parent is the box. the Box's child is the script.
Reply
#4
To find a child inside a parent, you can either go

[lua]
box.[[childsname]]
[/lua]

or, and you have to do this if there's a space in the name,

[lua]
box:getChild("[[childsname]]")
--or in ROBLOX
box:findFirstChild("[[childsname]]")
[/lua][/lua]
Reply
#5
Can't you also do,

[lua]

box["childsname"]

[/lua]

Sorry it's been a while since I've scripted in Lua.
Reply
#6
I think so, but I've almost never seen it used.
Reply
#7
You can't do box.[["childname"]] it's box["childname"].Whatever
Reply
#8
(06-18-2011, 01:37 AM)noob007 Wrote: Can't you also do,

[lua]

box["childsname"]

[/lua]

Sorry it's been a while since I've scripted in Lua.

The advantage of doing it that way is that you can use variables. box.variableName will give you the child named variableName, but box[variableName] (no quotes) will give you the child with the name that is stored in the variable.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)