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
|
  |
| Joined: 30 Sep 2008 |
| Total Posts: 5678 |
|
| |
|
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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 65 |
|
| |
|
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
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 65 |
|
| |
|
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
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 21 Mar 2014 09:27 PM |
Typo;
script.Parent.Touched:connect(function(hit) |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 09:28 PM |
c = hit.Parent:GetChildren()
|
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| Joined: 30 Dec 2011 |
| Total Posts: 285 |
|
|
| 21 Mar 2014 09:34 PM |
A debounce is something a scripter should practice |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|