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 » Scripting Helpers
Home Search
 

Re: Works once then doesn't?

Previous Thread :: Next Thread 
mark298 is not online. 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 is not online. mark298
Joined: 24 Oct 2008
Total Posts: 1264
08 Aug 2012 05:51 AM
Does anybody know whats wrong?
Report Abuse
Cheater is not online. 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 is not online. 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 is not online. mark298
Joined: 24 Oct 2008
Total Posts: 1264
08 Aug 2012 10:26 AM
I don't see anything different?
Report Abuse
mark298 is not online. 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 is not online. 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 is not online. mark298
Joined: 24 Oct 2008
Total Posts: 1264
08 Aug 2012 10:55 AM
Bump... Anybody?
Report Abuse
FlamedSkull is not online. FlamedSkull
Joined: 23 May 2009
Total Posts: 1379
08 Aug 2012 11:23 AM
Wait, what's q?
Report Abuse
mark298 is not online. mark298
Joined: 24 Oct 2008
Total Posts: 1264
08 Aug 2012 11:42 AM
The TextButton.
Report Abuse
mark298 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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