yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 07 Mar 2015 11:54 AM |
| How can i do FindFirstChild() of type Model |
|
|
| Report Abuse |
|
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 07 Mar 2015 11:59 AM |
I am trying to find a child of the character which is a model
so?
Char:FindFirstChild(model) |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2015 12:02 PM |
You have to define character and model
I wanna be a future game dev :3 |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 07 Mar 2015 12:03 PM |
Like?
I have already defined character, but i want it to search and if there is a model then assign the variable to that |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2015 12:05 PM |
if not char:FIndFirstChild("Model") then print("No model :P") else -- do stuff end
I wanna be a future game dev :3 |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2015 12:06 PM |
local model = char:FindFirstChild("Model")
I wanna be a future game dev :3 |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 07 Mar 2015 12:06 PM |
| then how do i set the model it finds asa variable |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2015 12:09 PM |
if not char:FIndFirstChild("Model") then print("No model :P") else model = char:FindFirstChild("Model") end
I wanna be a future game dev :3 |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Mar 2015 12:12 PM |
1. You can't set a variable to be anything but a pointer/reference to the model 2. You can't set a variable to change the model 3. You can only execute methods/grab properties from the variable 4. :FindFirstChild() works on every service/object (for it is derived by superclass Instance) 5. :FindFirstChild(String object) requires a String. 6. You can also... game.FindFirstChild(Workspace.Model, "Head") |
|
|
| Report Abuse |
|
|
Froast
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 3134 |
|
|
| 07 Mar 2015 12:15 PM |
In case the model isn't named 'Model':
FindFirstChildOfClass = function(object,class) for _,child in next, object:GetChildren() do if child:IsA(class) then return child end end end
local model = FindFirstChildOfClass(char,'Model') |
|
|
| Report Abuse |
|
|