of     1   

Klovod
#183163265Sunday, February 07, 2016 6:34 PM GMT

My script will look in the player for a model and then look inside the model for a head. Basically like this. Workspace.Player.Model.Head.Transparency = 0 It's simple but the problem is that I need to tell the script to find all heads inside the player and make it fully transparent. If I say findFirstChild("Head"), it doesn't find the head because the head is in the model. What do I do to solve this?? function onTouch(part) local human = part.Parent:findFirstChild("Humanoid") if human ~= nil then part.Parent:findFirstChild("Model").Head.Transparency = 1 end end script.Parent.Touched:connect(onTouch)
cheesecake123456
#183163354Sunday, February 07, 2016 6:36 PM GMT

You mean like: local model = part.Parent:FindFirstChild('Model') if model then local head = mode:FindFirstChild('Head') if head then head.Transparency = 1 end end
Klovod
#183163367Sunday, February 07, 2016 6:36 PM GMT

I know that I can just say "findFirstChild("Model").Head" but I just can't do that because of anoter reason. I need it to just look in the player for all strings called head.
cheesecake123456
#183163390Sunday, February 07, 2016 6:36 PM GMT

local head = model:FindFirstChild('Head') *
Klovod
#183163395Sunday, February 07, 2016 6:36 PM GMT

Thank you^^^
cheesecake123456
#183163631Sunday, February 07, 2016 6:39 PM GMT

If you are searching for all heads inside the character, which could be stored inside anything else: local heads = {} function SearchForHead(par) for _, v in pairs(par) do if v:IsA('Part') and par.Name == 'Head' then table.insert(heads, v) else SearchForHead(v) end end end SearchForHead(Character) -- put a link to the character here
Klovod
#183163683Sunday, February 07, 2016 6:40 PM GMT

Can you put your script in my script for me? I tried doing it and it won't make the head in the model transparent. It works like this: Player.(local model).Head.Transparency = 0
Klovod
#183163837Sunday, February 07, 2016 6:43 PM GMT

I have a name command script that makes your head transparent and then creates a model in the player and in the model is a head and humanoid. When you say your name, for example "name/ROBLOX," the name of the model will be ROBLOX. I need my script to look in the player for that model and change the transparency of the head in the model to 1. Remember that the model can have any string.
cheesecake123456
#183164063Sunday, February 07, 2016 6:46 PM GMT

local heads = {} function SearchForHead(par) for _, v in pairs(par) do if v:IsA('Part') and v.Name == 'Head' then table.insert(heads, v) else SearchForHead(v) end end end script.Parent.Touched:connect(function(part) local human = part.Parent:findFirstChild("Humanoid") if human then SearchForHead(human.Parent) for _, v in pairs(heads) do v.Transparency = 1 end end end)
cheesecake123456
#183164110Sunday, February 07, 2016 6:47 PM GMT

Oh, there is only one head, ignore that script XD
cheesecake123456
#183164180Sunday, February 07, 2016 6:48 PM GMT

Will just come up with a script, hold on
Klovod
#183164380Sunday, February 07, 2016 6:51 PM GMT

okay, let me explain further. You know how there is a head inside the player? Ignore that. Let's say there is a model inside the player and it has a head inside that model that is not transparent while the original head is. I want both heads to be transparent. So there are two heads in the player but one of those heads is in a model and that model is in the player. Player.head (that is already transparent, it doesn't matter. Ignore it) Player.Model.Head (that head is not transparent and is fully visible, I want to attack that head to make it transparent so then both heads can be transparent together.) If you attack both heads in the player then it won't make sense because one of those heads is already transparent. The head I want to attack is the head that is in a model. I want it to be transparent when you touch a part
Klovod
#183164617Sunday, February 07, 2016 6:55 PM GMT

This is the script that I comprised with yours, it isn't working. function onTouch(part) local human = part.Parent:findFirstChild("Humanoid") if human ~= nil then local model = part.Parent:FindFirstChild('Model') if model then local head = model:findFirstChild('Head') * if head then head.Transparency = 1 end end script.Parent.Touched:connect(onTouch)
cheesecake123456
#183164908Sunday, February 07, 2016 6:59 PM GMT

Think I got it this time: script.Parent.Touched:connect(function(part) local human = part.Parent:FindFirstChild('Humanoid') if human then local char = human.Parent local model = nil for _, v in pairs(char:GetChildren()) do if v:IsA('Model') then model = v break end end if model then local head = model:FindFirstChild('Head') if head then head.Transparency = 1 end end end end)
Klovod
#183165197Sunday, February 07, 2016 7:03 PM GMT

Oh my god, it actually worked. You deserve a cookie.

    of     1