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 » Scripters
Home Search
 

Re: How can i find a model from a textboxe's input?

Previous Thread :: Next Thread 
LeafDoode is not online. 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 is not online. 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
DidSomeoneSayWaffles is not online. DidSomeoneSayWaffles
Joined: 16 Mar 2014
Total Posts: 537
15 Sep 2017 11:37 PM
wait so when you click whatever this is, you want an object to spawn?
Report Abuse
LeafDoode is not online. 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
DidSomeoneSayWaffles is not online. DidSomeoneSayWaffles
Joined: 16 Mar 2014
Total Posts: 537
15 Sep 2017 11:40 PM
v : isa, not v:isa? i forgot the response
Report Abuse
kylerzong is not online. kylerzong
Joined: 06 Aug 2011
Total Posts: 659
15 Sep 2017 11:42 PM
what do you want to happen?
Report Abuse
LeafDoode is not online. 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 is not online. kylerzong
Joined: 06 Aug 2011
Total Posts: 659
15 Sep 2017 11:45 PM
invite to teamcreate
Report Abuse
LeafDoode is not online. 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 is not online. kylerzong
Joined: 06 Aug 2011
Total Posts: 659
15 Sep 2017 11:47 PM
invite me to teamcreate ill fix it
Report Abuse
LeafDoode is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. kylerzong
Joined: 06 Aug 2011
Total Posts: 659
15 Sep 2017 11:53 PM
just teamcreate me bro
Report Abuse
LeafDoode is not online. LeafDoode
Joined: 29 May 2017
Total Posts: 3094
15 Sep 2017 11:53 PM
well okay if you say so.
Report Abuse
kylerzong is not online. 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
DidSomeoneSayWaffles is not online. DidSomeoneSayWaffles
Joined: 16 Mar 2014
Total Posts: 537
16 Sep 2017 12:00 AM
Are all the childs in the right parents? we need to know more
Report Abuse
kylerzong is not online. kylerzong
Joined: 06 Aug 2011
Total Posts: 659
16 Sep 2017 12:08 AM
Fixed
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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