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: Change Various Parts' Color On Touch

Previous Thread :: Next Thread 
GeorgeTolsmaIII is not online. GeorgeTolsmaIII
Joined: 10 Feb 2011
Total Posts: 700
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 is not online. 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
GeorgeTolsmaIII is not online. GeorgeTolsmaIII
Joined: 10 Feb 2011
Total Posts: 700
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
GeorgeTolsmaIII is not online. GeorgeTolsmaIII
Joined: 10 Feb 2011
Total Posts: 700
12 Apr 2015 06:41 PM
Bump plz.
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
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
GeorgeTolsmaIII is not online. GeorgeTolsmaIII
Joined: 10 Feb 2011
Total Posts: 700
12 Apr 2015 07:34 PM
This works. Thank you. :)
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