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: How do i change the character's color?

Previous Thread :: Next Thread 
Ahkaiken is not online. Ahkaiken
Joined: 14 Jan 2013
Total Posts: 65
21 Mar 2014 08:42 PM
Like make someone's limbs change color on contact with a brick?
Report Abuse
zomg44 is not online. zomg44
Joined: 30 Sep 2008
Total Posts: 5678
21 Mar 2014 08:44 PM
goto freemodels lel
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
21 Mar 2014 08:45 PM
use touched
check if the touched argument has a humanoid
get all the children that're parts
recolor
the end
-=Robo=-
Report Abuse
Ahkaiken is not online. Ahkaiken
Joined: 14 Jan 2013
Total Posts: 65
21 Mar 2014 09:05 PM
This is as far as i got. I'm trying to make this work for all the bricks in a model.

Children = Workspace.Model:GetChildren()
function Touch(part)
local person = part.Parent:FindFirstChild("Humanoid")
if person then
--What do i put here?
end
end
for i,v in pairs(Children) do
if v:isA("BasePart") then
v.Touched:connect(Touch)
end
end
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Mar 2014 09:08 PM

Add this

for Index, Child in pairs(part.Parent:GetChildren()) do
if Child:IsA("BasePart") then
Child.BrickColor = BrickColor.new("Bright red") --Change here
end
end

This will iterate through the player's character, find all of the body parts, and change the color.
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
21 Mar 2014 09:11 PM
if person then
for i = 1, #Children do
i.BrickColor = ""--brick color string goes here
end
try putting that in, I think I made a mistake like missing brackets or something but why check, tell me if it doesn't work
-=Robo=-
Report Abuse
Ahkaiken is not online. Ahkaiken
Joined: 14 Jan 2013
Total Posts: 65
21 Mar 2014 09:11 PM
Thank you.
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
21 Mar 2014 09:11 PM
nvm, knightmare's is probably better and i forgot in pairs lol
-=Robo=-
Report Abuse
Ahkaiken is not online. Ahkaiken
Joined: 14 Jan 2013
Total Posts: 65
21 Mar 2014 09:22 PM
Only Knightmare's worked.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
21 Mar 2014 09:26 PM
local deb = false

script.Parent.Touched:Connect(function(hit)
if deb == false then deb = true end
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
c = hit.Parent
for i = 1,#c do
if c[i]:IsA("BasePart") then
c[i].BrickColor = BrickColor.new("BrickColorHere")
deb = false
end end end end)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
21 Mar 2014 09:27 PM
Typo;

script.Parent.Touched:connect(function(hit)
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Mar 2014 09:28 PM
c = hit.Parent:GetChildren()
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
21 Mar 2014 09:29 PM
^Thanks.

local deb = false

script.Parent.Touched:connect(function(hit)
if deb == false then deb = true end
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
c = hit.Parent:GetChildren()
for i = 1,#c do
if c[i]:IsA("BasePart") then
c[i].BrickColor = BrickColor.new("BrickColorHere")
deb = false
end end end end)
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Mar 2014 09:32 PM
What's the point of that debounce?

Logically, it does nothing. Usually, you would either return if deb is true, or nest the other code into the deb if statement.
Report Abuse
teeter11 is not online. teeter11
Joined: 30 Dec 2011
Total Posts: 285
21 Mar 2014 09:34 PM

A debounce is something a scripter should practice
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Mar 2014 09:39 PM
What I'm trying to say is that he didn't use the Debounce properly, thus it does not do anything.
Report Abuse
CitreIthkarr is not online. CitreIthkarr
Joined: 09 Jan 2014
Total Posts: 454
21 Mar 2014 09:59 PM
you guys r noobs characters use an object called 'Body Colors'

it's the only way to properly recolor the players i think
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Mar 2014 10:02 PM
No. You can directly change the color. However, it would also be a good idea to change the BodyColors, as sometimes it might revert to those colors.
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