LeafDoode
|
  |
| Joined: 29 May 2017 |
| Total Posts: 3094 |
|
|
| 15 Sep 2017 11:24 PM |
local Folder = script.Parent local ModelEditor = Folder.Parent local Submit = ModelEditor:WaitForChild("Submit")
local ModelName = ModelEditor:WaitForChild("ModelName") local ModelColor = ModelEditor:WaitForChild("ModelColor")
local Model = workspace:FindFirstChild(ModelName.Text) -- right here am i doing something wrong? |
|
|
| Report Abuse |
|
|
LeafDoode
|
  |
| Joined: 29 May 2017 |
| Total Posts: 3094 |
|
|
| 15 Sep 2017 11:26 PM |
actually
full code
--//LeafDoode
local Folder = script.Parent local ModelEditor = Folder.Parent local Submit = ModelEditor:WaitForChild("Submit")
local ModelName = ModelEditor:WaitForChild("ModelName") local ModelColor = ModelEditor:WaitForChild("ModelColor")
local Model = workspace:FindFirstChild(ModelName.Text)
Submit.MouseButton1Click:connect(function() ModelEditor.Visible = false for i,v in pairs(Model:GetChildren()) do--i am trying to get the children if v:IsA("BasePart") then v.BrickColor = BrickColor.new(ModelColor.Text) end end end) |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2017 11:37 PM |
wait so when you click whatever this is, you want an object to spawn?
|
|
|
| Report Abuse |
|
|
LeafDoode
|
  |
| Joined: 29 May 2017 |
| Total Posts: 3094 |
|
|
| 15 Sep 2017 11:38 PM |
here is the correct script :
--//LeafDoode
local Folder = script.Parent local ModelEditor = Folder.Parent local Submit = ModelEditor:WaitForChild("Submit")
local ModelName = ModelEditor:WaitForChild("ModelName") local ModelColor = ModelEditor:WaitForChild("ModelColor")
Submit.MouseButton1Click:connect(function() ModelEditor.Visible = false local Model = workspace:FindFirstChild(ModelName.Text)
for i,v in pairs(Model:GetChildren()) do if v:IsA("BasePart") then v.BrickColor = BrickColor.new(ModelColor.Text) end end end)
cmon any one? |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2017 11:40 PM |
| v : isa, not v:isa? i forgot the response |
|
|
| Report Abuse |
|
|
kylerzong
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 659 |
|
|
| 15 Sep 2017 11:42 PM |
| what do you want to happen? |
|
|
| Report Abuse |
|
|
LeafDoode
|
  |
| Joined: 29 May 2017 |
| Total Posts: 3094 |
|
|
| 15 Sep 2017 11:44 PM |
v:IsA
is correct
The output is erroring on the for loop
Players.LeafDoode.PlayerGui.ColorGui.ModelEditor.Code.MainCode:16: attempt to index local 'Model' (a nil value) |
|
|
| Report Abuse |
|
|
kylerzong
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 659 |
|
| |
|
LeafDoode
|
  |
| Joined: 29 May 2017 |
| Total Posts: 3094 |
|
|
| 15 Sep 2017 11:46 PM |
"what do you want to happen? "
i have 2 textboxes
one for model name
and one for model color
i have a button
if you press that button it checks the name of the model in workspace that you typed in the "modelname textbox" and gets every part and changes its color to the "modelcolor textbox" |
|
|
| Report Abuse |
|
|
kylerzong
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 659 |
|
|
| 15 Sep 2017 11:47 PM |
| invite me to teamcreate ill fix it |
|
|
| Report Abuse |
|
|
LeafDoode
|
  |
| Joined: 29 May 2017 |
| Total Posts: 3094 |
|
|
| 15 Sep 2017 11:48 PM |
I don't wanna waste your time.
i just want the fix to the for loop. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 15 Sep 2017 11:48 PM |
TextBoxA = TextBoxB = -- point to these please
for _,v in next,workpsace:FindFirstChild(TextBoxA.Text):GetChildren() do v.BrickColor = BrickColor.new(TextBoxB.Text) end |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 15 Sep 2017 11:49 PM |
| By the way, a lot of your variables are only set once at the top of the script. They should be set again when you submit. |
|
|
| Report Abuse |
|
|
kylerzong
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 659 |
|
|
| 15 Sep 2017 11:50 PM |
local Model = workspace:FindFirstChild(ModelName.Text)
doesn't exist br0 |
|
|
| Report Abuse |
|
|
LeafDoode
|
  |
| Joined: 29 May 2017 |
| Total Posts: 3094 |
|
|
| 15 Sep 2017 11:52 PM |
Players.LeafDoode.PlayerGui.ColorGui.ModelEditor.Code.MainCode:16: attempt to index a nil value
it always errors on the for loop |
|
|
| Report Abuse |
|
|
kylerzong
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 659 |
|
| |
|
LeafDoode
|
  |
| Joined: 29 May 2017 |
| Total Posts: 3094 |
|
| |
|
kylerzong
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 659 |
|
|
| 15 Sep 2017 11:55 PM |
ok also we can make it so when they press a button their mouse will change to the dropper icon and then they can click on the model |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2017 12:00 AM |
| Are all the childs in the right parents? we need to know more |
|
|
| Report Abuse |
|
|
kylerzong
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 659 |
|
| |
|