I wrote a function for my game that gets called when a player presses “Z”, which should show the body by setting their LocalTransparencyModifier to 0, but for some reason it just turns back to 1???
-- Show body
model.Humanoid.CameraOffset = module.NoCameraOffset
for i,v in pairs(model:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") and v.Name ~= "Head" and v ~= model.PrimaryPart then
if v.Name ~= "Head" and v ~= characterModel.primaryPart then
--v.Transparency = 0
v.LocalTransparencyModifier = 0
print(v.LocalTransparencyModifier)
end
end
end
module.IsBodyHidden = false
task.wait(2)
for i,v in pairs(model:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
if v.Name ~= "Head" and v ~= characterModel.primaryPart then
print(v.LocalTransparencyModifier)
end
end
end
end
this prints the transparencymodifier’s value again after 2 seconds and you can see its 1 again.
I also do not have any other scripts affecting the LocalTransparencyModifier.