I cant change the character Transparency

I am making one kill effect and when the humanoid dies I want to change the character transparency to 1 (everything inside it but the kill effect part with SurfaceGuis dont change transparency)

one gif just for see one exemple:

basicly faces, hats everything like that doesnt change…

The script:

local tool = script.Parent
local Effect = game.ReplicatedStorage.DeletePart
local Sound = game.Workspace.SoundEffect
local debounce = false
	
	

--------------------------- here the kill effect function------------------------------
tool.HammerParts.HitPart.Touched:Connect(function(hit)	 
	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health <= 0 then
		Sound:Play()
		debounce = true
		local character = hit.Parent	
		local humanoid = character.Humanoid
		Sound.Parent = character
		humanoid.BreakJointsOnDeath = false
		humanoid.Died:Connect(function()
			local torso = character.Torso
			local humanoidRootPart = character.HumanoidRootPart
			humanoidRootPart.Anchored = true	
			local EffectClone = Effect:Clone()
			EffectClone.Parent = character
			EffectClone.Position = torso.Position
			for i,v in pairs(character:GetChildren()) do
				v.Transparency = 1
			end	

			debounce = false
		end)
	end
end)
----------------------------------------------------------------------------------------

Also how I can play the sound only when the humanoid dies because the sound only plays when the character is gone…

Get the baseparts using :GetDescendants() in a for _,v

for i,v in pairs(character:GetDescendants()) do
if v:IsA(“BasePart”) then
v.Transparency = 1
end
end

1 Like

alr and about the sound what I can do? :face_with_raised_eyebrow:

local tool = script.Parent
local Effect = game.ReplicatedStorage.DeletePart
local Sound = game.Workspace.SoundEffect
local debounce = false
	
	

--------------------------- here the kill effect function------------------------------
tool.HammerParts.HitPart.Touched:Connect(function(hit)	 
	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health <= 0 then
		Sound:Play()
		debounce = true
		local character = hit.Parent	
		local humanoid = character.Humanoid
		Sound.Parent = character
		humanoid.BreakJointsOnDeath = false
		humanoid.Died:Connect(function()
			local torso = character.Torso
			local humanoidRootPart = character.HumanoidRootPart
			humanoidRootPart.Anchored = true	
			local EffectClone = Effect:Clone()
			EffectClone.Parent = character
			EffectClone.Position = torso.Position
			for i,v in pairs(character:GetChildren()) do
v:Destroy()
				v.Transparency = 1
			end	
character.Head.face:Destroy()

			debounce = false
		end)
	end
end)

What? Is there an issue with the sound? If so please elaborate

the sound only plays when the character got deleted.

Tick the “PlayOnRemove” off

Use GetDescendants instead, for accessories you can destroy them.

for i,v in pairs(character:GetDescendants()) do
    if v:IsA("Decal") or v:IsA("BasePart") then
        v.Transparency = 1
    elseif v:IsA("Accessory") then
        v:Destroy()
    end
end

thats dont work I mean you can kill but the player doesnt respawn

https://i.gyazo.com/f00c016ec69320426430fcfc41ab3fe0.mp4

it was off but the sound is on workspace

local tool = script.Parent
local Effect = game.ReplicatedStorage.DeletePart
local Sound = game.Workspace.SoundEffect
local debounce = false
	
	

--------------------------- here the kill effect function------------------------------
tool.HammerParts.HitPart.Touched:Connect(function(hit)	 
	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health <= 0 then
		Sound:Play()
		debounce = true
		local character = hit.Parent	
		local humanoid = character.Humanoid
		Sound.Parent = character
		humanoid.BreakJointsOnDeath = false
		humanoid.Died:Connect(function()
			local torso = character.Torso
			local humanoidRootPart = character.HumanoidRootPart
			humanoidRootPart.Anchored = true	
			local EffectClone = Effect:Clone()
			EffectClone.Parent = character
			EffectClone.Position = torso.Position
			for i,v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v:Destroy()
				v.Transparency = 1
			end	
end
character.Head.face:Destroy()

			debounce = false
		end)
	end
end)

Try this then.

Just replace the loop that changes the transparency of the character from “GetChildren” to “GetDescendants”, it will loop through every part in the character

tool.HammerParts.HitPart.Touched:Connect(function(hit)	 
	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health <= 0 then
		Sound:Play()
		debounce = true
		local character = hit.Parent	
		local humanoid = character.Humanoid
		Sound.Parent = character
		humanoid.BreakJointsOnDeath = false
		humanoid.Died:Connect(function()
			local torso = character.Torso
			local humanoidRootPart = character.HumanoidRootPart
			humanoidRootPart.Anchored = true	
			local EffectClone = Effect:Clone()
			EffectClone.Parent = character
			EffectClone.Position = torso.Position

            for key, object in pairs(character:GetDescendants()) do
                if object:IsA("BasePart") then
                    object.Transparency = 1
                elseif object:IsA("Decal") then
                    object.Transparency = 1
                end
            end

			debounce = false
		end)
	end
end)

And it should be done!

1 Like

thats works fine but the only problem I am having its with he sound (he looks delayed he plays some time after)

Maybe that’s because the sound itself it’s delayed, when it plays it has a bit of silence at the beggining, you know what I mean

1 Like

Yes I know but thats really sad I really want to play it on the same moment. Btw thank for your help (and from everyone who replied too)