Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you make this script turn black, and fade away before they respawn?

I tried to work this, but it wouldn't work, could someone show me how you would make a player turn black and fade away, when they die, but like right before they respawn they fade away?

game.Players.PlayerAdded:connect(function(player)

player.CharacterAdded:connect(function(character)

character:WaitForChild("Humanoid").Died:connect(function()

print (player.Name .. " has died...")

end)

end)

end)

1 answer

What do you mean "turn black"? Do you mean their body parts turn black? If so:

game.Players.PlayerAdded:connect(function(player)
	Delay(0, function() -- This prevents a yield from pausing the script (In this case, the WaitForChild)
		player.CharacterAdded:connect(function(character)
			local humanoid = character:WaitForChild("Humanoid")
	
			humanoid.Died:connect(function()
				print (player.Name .. " has died...")
	
				for _, part in pairs(character:children()) do
					if part:isA("BasePart") then
						part.BrickColor = BrickColor.new("Black")

						Delay(2, function() -- Yield protection; runs 2 seconds later.
							for i = 0, 1, 0.1 do
								part.Transparency = i
								wait()
							end
						end
					end
				end
			end)
		end)
	end)
end)

3 comments

0

Yes, turn black and fade away.

0

Oh, and fade away? Standby.

0

Edited.

This discussion is preserved as it was. New answers, comments, and votes are closed.