Hi, I’m trying to make a death GUI where after the GUI shows, it later fades away. Something like Dark souls’ death screen.
Though, the problem is it won’t work nor give the output any errors when I try to make the GUI fade away. Some reason the color correction effect works but not my GUI.
I’ve tried adding a wait function to let the GUI fade in, then later fade out. I also tried not using a module function and making a table for the fade out function on the same script. None of these worked though.
Here is an example of the effect I want to achieve
0:01-0:02 is what I am trying to replicate
(Note: This is my first post, so I apologize for any mistakes I may have not noticed during writing this)
GUI Script:
local Player = game:GetService("Players").LocalPlayer
local Players = game:GetService("Players").PlayerAdded
Players:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Character:WaitForChild("Humanoid").Died:Connect(function()
local PlayerGUI = Player.PlayerGui
PlayerGUI:WaitForChild("DeathScreenGUI").Enabled = true
local DeathModule = require(game:GetService("ReplicatedStorage"):WaitForChild("DeathModuleScript"))
local DeathBackground = PlayerGUI:WaitForChild("DeathScreenGUI").DeathBackground
DeathModule.DBGFunction1(DeathBackground)
local DeathTitle = PlayerGUI:WaitForChild("DeathScreenGUI").DeathTitle
DeathModule.DTFunction1(DeathTitle)
wait(1)
DeathModule.DTFunction2(DeathBackground)
DeathModule.DBGFunction2(DeathTitle)
local DeathColor = Instance.new("ColorCorrectionEffect",game.Lighting)
DeathModule.DCFunction1(DeathColor)
wait(9)
DeathModule.DCFunction2(DeathColor)
end)
end)
end)
Module Script:
local DeathModule = {}
local TweenService = game:GetService("TweenService")
DeathModule.DBGFunction1 = function(DBGObject)
local DBGInfo = TweenInfo.new(0.6, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 1)
local DBGGoal = {ImageTransparency = 0.3}
local DBGTween = TweenService:Create(DBGObject, DBGInfo, DBGGoal)
DBGTween:Play()
return DBGTween
end
DeathModule.DTFunction1 = function(DTObject)
local DTinfo = TweenInfo.new(0.8, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 1)
local GTGoal = {ImageTransparency = 0, Size = UDim2.new(0.2, 230, 0.1, 30), Position = UDim2.new(0.3, 10, 0.5, -32)}
local GTTween = TweenService:Create(DTObject, DTinfo, GTGoal)
GTTween:Play()
return GTTween
end
DeathModule.DBGFunction2 = function(DBGObject)
local DBGInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 1)
local DBGGoal = {ImageTransparency = 1}
local DBGTween = TweenService:Create(DBGObject, DBGInfo, DBGGoal)
DBGTween:Play()
return DBGTween
end
DeathModule.DTFunction2 = function(DTObject)
local DTinfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 1)
local GTGoal = {ImageTransparency = 1}
local GTTween = TweenService:Create(DTObject, DTinfo, GTGoal)
GTTween:Play()
return GTTween
end
DeathModule.DCFunction1 = function(DCObject)
local DCinfo = TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 1)
local DCGoal = {Brightness = -0.3, Contrast = -0.3, Saturation = -1}
local DCTween = TweenService:Create(DCObject, DCinfo, DCGoal)
DCTween:Play()
return DCTween
end
DeathModule.DCFunction2 = function(DCObject)
local DCinfo = TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 1)
local DCGoal = {Brightness = 0, Contrast = 0, Saturation = 0}
local DCTween = TweenService:Create(DCObject, DCinfo, DCGoal)
DCTween:Play()
return DCTween
end
return DeathModule