I know Its supposed to make a frame fade in and fade out in its transparency smoothly, But I want to know how this script works so I can use this in other scripts. So can maybe one day smoothly fade and out color.
fade = script.Parent
fadeGoal = 0
fadeRate = 0.05
function updateFade()
local current = fade.BackgroundTransparency
if current < fadeGoal then
fade.BackgroundTransparency = math.min(fadeGoal,current+fadeRate)
elseif current > fadeGoal then
fade.BackgroundTransparency = math.max(fadeGoal,current-fadeRate)
else
fade.BackgroundTransparency = fadeGoal
end
end
player = game.Players.LocalPlayer
character = player.Character or player.CharacterAdded:wait()
humanoid = player.Character:WaitForChild("Humanoid")
rs = game:GetService("RunService")
fadeGoal = 1
humanoid.Died:connect(function ()
wait(1)
fadeGoal = 0
player.CharacterAdded:wait()
fadeGoal = 1
end)
rs.RenderStepped:connect(updateFade)
fade.Visible = true

1 comment
:c