you can use for loops, loop through each body part of the person!
local Troll = script.Parent
local Debounce = false
Troll.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if not Debounce then
Debounce = true
for _, Part in Troll:GetChildren() do
if Part:IsA("BasePart") and Part.Name ~= "HumanoidRootPart" then
Part.Transparency = 1
end
end
wait(3)
for _, Part in Troll:GetChildren() do
if Part:IsA("BasePart") and Part.Name ~= "HumanoidRootPart" then
Part.Transparency = 0
end
end
wait(1)
Debounce = false
end
end)
but this script is too long so i'll create a function for that:
local Troll = script.Parent
local Debounce = false
local function SetTransparency(Transparency)
for _, Part in Troll:GetChildren() do
if Part:IsA("BasePart") and Part.Name ~= "HumanoidRootPart" then
Part.Transparency = Transparency
end
end
end
Troll.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if not Debounce then
Debounce = true
SetTransparency(1)
wait(3)
SetTransparency(0)
wait(1)
Debounce = false
end
end)
notice that i ignore HumanoidRootPart since that should always stay invisible.