Roblox Studio Tutorials - February 14, 2022

How to Change Color of a Part on Touch




Download – Part Script

How To – Change Color of a Part on Touch in Roblox Studio

What’s up everyone welcome to buzzygames, my name is BuzzyGamesBeth and today I’ll be teaching you how to change color of a part on touch!

  • Let’s learn how to change the color of a part on touch. Right now, we just have this normal spawn location. By default it’s gray and if we touch it, nothing should happen at all. The color will just stay the same. We want to change it where any time I touch this part, it changes to a different color.
  • Inside of our workspace, go ahead and add a script inside of our part. I’m just going to go ahead and add it inside of our spawn location. Go ahead and delete our print statement, we won’t be using that as always. We’re going to go ahead and do script.Parent.touched.
  • We’re going to create a function where anytime we touch our spawn location or part, the brick color is going to change to whatever you want. For me, my favorite color is red, so I’m going to go ahead and do bright red. You can do a random color if you would like. I’m going to wait about one second, and then it changed back to the original color of the part.
  • To check the original color of my spawn, you can go to the RGB properties and copy and paste that color coordinates. Paste it inside of our parentheses, and then that’s it! I’m gonna go ahead and hop inside of my game. If I touch the spawn location right nowm it’s gray. If I touch it, it should turn red. After one second, it just changes back to its original color.