When players turn invisible and then visible again, the blue brick of the HumanoidRootPart is visible and obscures the character models of the game. How can I loop it so it stays invisible?
c=script.Parent:children() for i=1,#c do if c[i].className=="Part"then c[i].Transparency=0 if c[i].Name=="HumanoidRootPart"then c[i].Transparency=1 end end end
Try using the Changed event to detect changes, something like this should suffice:
function Fix(Char) Char.HumanoidRootPart.Changed:connect(function(p) if string.lower(tostring(p)) == "transparency" then pcall(function() Char.HumanoidRootPart.Transparency = 1 end) end end) end game:GetService("Players").PlayerAdded:connect(function(Plr) repeat wait(1/30) until Plr.Character ~= nil and Plr.Character.Parent == Workspace and Plr.Character:findFirstChild("HumanoidRootPart") Fix(Plr.Character) Plr.CharacterAdded:connect(Fix) end)
Basically, follow these steps:
Step 1: Make a script
Step 2: Put it in StarterGui
Step 3: Put this code in this script:
while true do repeat wait() until script.Parent.Parent.Character ~= nil script.Parent.Parent.Character.HumanoidRootPart.Transparency = 1 end