|
| 12 Apr 2015 05:45 PM |
What I'm working with: https://twitter.com/Daytona2090/status/587384859670216704
Basic of what I want to happen: When the person sits in the car's seat, the "Body Panel" parts change from Red to Blue. There is 51 Body Panel Parts, so I'd like to not do it the easy way with
function onTouched(hit) script.Parent.BodyPanel1.BrickColor = BrickColor.new("Bright blue") script.Parent.BodyPanel2.BrickColor = BrickColor.new("Bright blue") etc etc.
Once I have that basic bit down, then I want to take it to the next step. There is a value inside of the player, named Main Color. I have a GUI that the person can choose a color, and the value changes to the BrickColor of the color chosen. I then want to make it so that when a person sits in the seat, it uses the value to change to that color.
I know some basics, but after trying different things for an hour, I can't get it figured out.Thanks for the readings. :)
|
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 12 Apr 2015 05:49 PM |
for _, panel in pairs(script.Parent) do if panel:IsA('BasePart') and string.find(panel.Name, 'BodyPanel') then panel.BrickColor = BrickColor.new('Bright blue') end end |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2015 06:04 PM |
I am afraid what you have provided doesn't quite work.
I made various changes after just using the base of what you gave, and nothing has worked.
Thanks for at least attempting.
|
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Apr 2015 06:59 PM |
local seat = script.Parent local root = 'Body Panel'
seat.ChildAdded:connect(function(instance) if instance:IsA('Weld') and instance.Name == 'SeatWeld' then local weld = instance local rootPart = weld.Part1 local player = rootPart and rootPart.Parent and game.Players:GetPlayerFromCharacter(rootPart.Parent) if player then for index, child in next, seat.Parent:GetChildren() do if child:IsA('BasePart') and child.Name:find(root) then child.BrickColor = BrickColor.Blue() end end end end end) |
|
|
| Report Abuse |
|
|
| |
|