|
| 03 Aug 2013 08:18 PM |
function ClickColorBuy() player = script.Parent.Parent.Parent if player.Points.Value >= 50 then Colors = script.Parent.ColorFrame:GetChildren() for i=1,#Colors do if Colors[i]:findFirstChild("MouseButton1Click")then pur = script.Parent.Purchase pur.Buying.Text = ("") end end end end
Colors = script.Parent.ColorFrame:GetChildren() for i=1,#Colors do Colors[i].MouseButton1Click:connect(ClickColorBuy) end
What i wanted was out of the Buttons in that frame, to find the one that was clicked, then the pur.Buying.Text will Equal the Text of the clicked one... Help D:, i do not know what to do... |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 08:32 PM |
| Where exactly are you having trouble? Are you getting any errors? |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 08:32 PM |
| Im not sure how to make that happen.. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 08:36 PM |
While in your place editor, go to the top of the screen to View > Output Window
When you run your script, the output will show any errors that may have occurred in your script. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 08:46 PM |
| I know, i do not know how to make the script find the button the player clicked from the frame, There is so many buttons, and i do not want to have to make a click trigger for them all,i made an attempt but, yeah, i do not know how to make this happen. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 08:52 PM |
| Absolutely nothing can work, i guess so... |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 08:55 PM |
Okay then. How about this? ______________________________________ player = script.Parent.Parent.Parent Colors = script.Parent.ColorFrame:GetChildren()
for i = 1, #Colors do Colors[i].MouseButton1Click:connect(function() if player.Points.Value >= 50 then pur = script.Parent.Purchase pur.Buying.Text = "" end) end
|
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 09:05 PM |
| Yes, but how can i make that text, be the text of the clicked one, there is a bunch of buttons, how can i make the text display the one that was clicked's text |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Aug 2013 09:09 PM |
Oh.
pur.Buying.Text = Colors[i].Text
That SHOULD work. Sorry if I've made you impatient. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 09:43 PM |
Thanks it worked, now i have this, and the Last part where it colors the vehicle, how can i get the Brick Color to be the backround color of the clicked one, i made an attempt, but there is no error, it just stays the same color and returns..
player = script.Parent.Parent.Parent Colors = script.Parent.ColorFrame:GetChildren()
for i = 1, #Colors do if Colors[i].ClassName == "TextButton" then Colors[i].MouseButton1Click:connect(function() pur = script.Parent.Purchase pur.Label.Text = ("Buying "..Colors[i].Text.."") pur.Visible = true script.Parent.ColorFrame.Visible = false pur.Buy.MouseButton1Click:connect(function() if player.Points.Value >= Colors[i].Cost.Value then player.Points.Value = player.Points.Value - Colors[i].Cost.Value Vehicle = game.Workspace.Building:findFirstChild(""..player.Name..""..player.Vehicle.Value.."") ColorAble = Vehicle:GetChildren() pur.Visible = false script.Parent.ColorFrame.Visible = true for i = 1, #ColorAble do if ColorAble[i]:findFirstChild("Color") then ColorAble[i].Color.Color = Color3.new(Colors[i].BackroundColor3) end end end end) end) end end |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 09:53 PM |
I'm assuming that "Color" is a Color3Value?
ColorAble[i].Color.Value = Color3.new(Colors[i].BackroundColor3)
I think all you did was accidentally replace "Value" with "Color". |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Aug 2013 10:08 PM |
Then I believe all you need is ColorAble[i].Color No need for the second one. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 10:09 PM |
| Actually, ColorAble[i].BrickColor |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 10:15 PM |
| Nah, because color is a brick, and its only supose to color the brick with the name Color |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 10:21 PM |
| Ohhhh. So, change it to ColorAble[i].Color.BrickColor? I'm starting to get confused. |
|
|
| Report Abuse |
|
|