|
| 07 Oct 2015 02:07 PM |
so im a novice scripter and this script wont work and i know why but dont know how to fix it:
script.Parent.ClickDetector.MouseClick:connect(function(hit) hit.torso.Transparency=0.5 hit.Head.Transparency=0.5 hit["Left Leg"].Transparency=0.5 hit["Right Leg"].Transparency=0.5 hit["Right Arm"].Transparency=0.5 hit["Left Arm"].Transparency=0.5 end)
so i know that the player(hit) doesn't store the body parts but how would i find the body parts then. Sorry as this seems like a basic question but im just a little stuck. Any ideas? |
|
|
| Report Abuse |
|
|
RoKjell
|
  |
| Joined: 22 Nov 2012 |
| Total Posts: 1205 |
|
|
| 07 Oct 2015 02:23 PM |
hit in this case, is your player, so if you'd print hit.name, you would get his name. You have to find the character from that player and then go to the parts you need, or to make it easy, change everything that "IsA" Part, which only uses 1 line instead of 6 for all his body parts.
You could make it a local script and use this:
local player = game.Players.LocalPlayer if player.Character then player.Character:GetChildren():IsA("Part").Transparency = 0.5 end
--If player.Character:GetChildren():IsA("Part").Transparency = 0.5 doesn't work, use your method instead, I didn't test it and never had to use it before.
Why? Because I can. |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Oct 2015 02:27 PM |
| You're checking if a table is a part. gg. |
|
|
| Report Abuse |
|
|
RoKjell
|
  |
| Joined: 22 Nov 2012 |
| Total Posts: 1205 |
|
|
| 07 Oct 2015 02:31 PM |
That's why I said it might not work XD I never tried that
Why? Because I can. |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2015 02:32 PM |
You want to loop through the table.
script.Parent.ClickDetector.MouseClick:connect(function(hit) for _,v in pairs(hit.Parent:GetChildren()) do --This loops through every child in hit.Parent, and checks if "v" is a part. if v:IsA'BasePart' then v.Transparency = 0.5 end end end) |
|
|
| Report Abuse |
|
|