Hello,
Currently I’m working on a feature which requires a GUI to appear when the player dies/resets their character. The GUI uses tweening to create a fade in/out effect.
I’m trying to make the GUI stay for 2 seconds in between the fade tweens. However, it does not wait before moving on to the second (fade out) effect.
The script:
local player = game.Players.LocalPlayer
local Fade = script.Parent.Frame
player.Character:WaitForChild('Humanoid').Died:Connect(function()
Fade.Visible = true
--The first tween (fade in)
local Info = TweenInfo.new(1)
local Tween = game:GetService("TweenService"):Create(Fade,Info,{BackgroundTransparency=0})
Tween:Play()
wait(2)
--The second Tween (fade out)
local Info = TweenInfo.new(1)
local Tween = game:GetService("TweenService"):Create(Fade,Info,{BackgroundTransparency=1})
Tween:Play()
wait(2)
Fade.Visible = false
end)
Also, Players.RespawnTime is set to 3.