I want a death message to fade in once you die. But I cannot get it to fade it just instantly appears. How do I fix this?
I'm sorry if my code isn't efficient as I'm new to this.
humanoid.HealthChanged:connect(function()
local hpMath = humanoid.Health / humanoid.MaxHealth
hpBar.Size = UDim2.new(hpMath,0,0.25,0)
if humanoid.Health == 0 then
print("Dead!")
local frame = gui.Parent.DeadMessage.Frame
local text = frame.Message
for trans = 1,0,-1 do --Won't fade?
frame.Transparency = trans
wait(1)
if frame.Transparency == 0 then
text.Visible = true
end
end
for timer=2,0,-1 do
text.Text = "You have died... "..timer
wait(1)
end
end
end)
Thanks.
