mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 08 Aug 2012 05:24 AM |
I made this script for a Color Car Gui and its has lots of different buttons because of all of the colors. I wanted to make one script in the Frame that makes all of them work instead of putting scripts in all of the buttons
I made this one and it works once and then just stops, Can anybody help?
Car = script.Parent.Parent.Parent.Parent.Character.TestCar t = script.Parent
function onClicked(v,q) for p = 1, #v do if (v[p].classname == "Part") then local Color = v[p]:findFirstChild("Color") if (Color~=nil) then v[p].BrickColor = BrickColor.new(q.Name) end end end end
c = t:children() for n = 1, #c do if (c[n].className == "Frame") then f = c[n]:children() for b = 1, #f do if (f[b].classname == "TextButton") then local v = Car:children() f[b].MouseButton1Click:connect(function()onClicked(v,f[b]) end) end end end end
|
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 08 Aug 2012 05:51 AM |
| Does anybody know whats wrong? |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 08 Aug 2012 06:06 AM |
Gotta post this in a better structur, so I can think better.
Car = script.Parent.Parent.Parent.Parent.Character.TestCar t = script.Parent
function onClicked(v,q) for p = 1, #v do if (v[p].classname == "Part") then local Color = v[p]:findFirstChild("Color") if (Color~=nil) then v[p].BrickColor = BrickColor.new(q.Name) end end end end
c = t:children() for n = 1, #c do if (c[n].className == "Frame") then f = c[n]:children() for b = 1, #f do if (f[b].classname == "TextButton") then local v = Car:children() f[b].MouseButton1Click:connect(function()onClicked(v,f[b]) end) end end end end
|
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 08 Aug 2012 06:10 AM |
Car = script.Parent.Parent.Parent.Parent.Character.TestCar t = script.Parent
function onClicked(v,q) for p = 1, #v do if (v[p].classname == "Part") then local Color = v[p]:findFirstChild("Color") if (Color~=nil) then v[p].BrickColor = BrickColor.new(q.Name) end end end end
c = t:children() for n = 1, #c do if (c[n].className == "Frame") then f = c[n]:children() for b = 1, #f do if (f[b].className == "TextButton") then --type mistake local v = Car:children() f[b].MouseButton1Click:connect(function()onClicked(v,f[b]) end) end end end end
|
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 08 Aug 2012 10:26 AM |
| I don't see anything different? |
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 08 Aug 2012 10:42 AM |
Ok, This is the script that needs fixing, It works and then if you try to pick another color it just changes them to the same color.
Can anybody help me please?
Car = script.Parent.Parent.Parent.Parent.Character.TestCar t = script.Parent
function onClicked(v,q) for p = 1, #v do if (v[p].ClassName == "Part") then local Color = v[p]:findFirstChild("Color") if (Color~=nil) then v[p].BrickColor = BrickColor.new(q.Name) end end end end
c = t:children() for n = 1, #c do if (c[n].ClassName == "Frame") then f = c[n]:children() for b = 1, #f do if (f[b].ClassName == "TextButton") then local v = Car:children() f[b].MouseButton1Click:connect(function()onClicked(v,f[b]) end) end end end end
|
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 08 Aug 2012 10:43 AM |
| @Above post, I don't mean to the same color as the button, I mean as say if the first color you press is blue, it changes blue but then if you press red or any other color it just goes blue. |
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
| |
|
| |
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
| |
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 08 Aug 2012 11:53 AM |
| Well, I've been testing it and it turns out no matter what button you press it keeps coloring it Bright Green... -_- |
|
|
| Report Abuse |
|
|