Trying to create a script where the player goes invisible while a clone of their character is made when their health is below 5. Then when the clone is made it goes into a rag doll state by losing its humanoid. Then when they have more then 5 health the clone is destroyed and the player comes visible again, but it says I'm attempting to index local 'Fake' which is an nil value.
Humanoid.Changed:connect(function() if Humanoid.Health <= 5 then local Fake = Player.Character:Clone() Fake.Humanoid.PlatformStand = true Fake.Humanoid:Destroy() for _,v in pairs(char:GetChildren()) do if v.className == "Part" then v.Transparency = 1 elseif v.className == "Hat" then v.Handle.Transparency = 1 elseif Humanoid.Health > 5 then Fake:Destroy() for _,v in pairs(char:GetChildren()) do if v.className == "Part" then v.Transparency = 1 elseif v.className == "Hat" then v.Handle.Transparency = 0 end end end end end end)