oh i see there is a misunderstanding here its a english mistake from which you are making such a big drama. now shut up and let me do my work? I am not wrong its just a english mistake I made. ok? please shut up. I am begging you.
yes. iâd shut up if you dont reply to me everytime. im not a native english speaker and i understand you. letâs just declear peace and we both shut up from now.
deal. bye.
Maybe you need to remove the .Parent part?
if v:FindFirstChild("Head") then
v:FindFirstChild("Head").Transparency = 1
end
Itâs hard to understand where âHeadâ is located and the screen grab doesnât really clarify anything. I assume that âHeadâ is inside one of those models? Are there only Models in the âOutfitâ folder? If so, rather than GetDescendants()
why not iterate the Models inside the âOutfitâ folder and use FindFirstChild()
, i.e.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local Outfit = char:WaitForChild("Outfit",3);
local Children = Outfit:GetChildren();
for i, v in pairs(Children) do
-- if there are other types of objects in the folder and head is guaranteed
-- to be a child of a Model then uncomment the next line
--if not v:IsA("Model") then contiune end;
local Head = v:FindFirstChild("Head");
if Head and Head:IsA("BasePart") then
Head.Transparency = 1;
break;
end
end
end)
end)
So you mean Head isnât a model but a part ?
I just got back on and because FindFirstChild doesnât work for some odd reason but waitforchild does
The issue is itâs not moving to the next line it stops at print(âFoundâ)
local Outfit = char:WaitForChild("Outfit",3);
print("Found")
for i,v in pairs(Outfit:GetChildren()) do
print("OutfitFound")
if v:IsA('Model') and v:FindFirstChild("Head") then
print(v.."found")
v:WaitForChild("Head").Transparency = 1
print("Transparency")
end
end
You may need to check it actually found âOutfitâ". So instead of print("Found")
do:
if Outfit then print("Found") else return end;
You must return if it is not found since there is no instance of Outfit. You can increase the timeout on WaitForChild()
the second parameter is the number of seconds to keep trying to obtain the child. The problem here is this logic is contained in PlayerAdded
which will be subject to replication issues if there is no chance for it to actually replicate fully before logic is applied. You could try a repeat until, i.e.
local Outfit = nil;
repeat
Outfit = char:FindFirstChild("Outfit");
until Outfit ~= nil;
But even with this method you may need a timeout to prevent an unyielding loop.
I fixed it had to remove a line
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.