local tweenServ = game:GetService("TweenService")
game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function()
local ui = game.Players.LocalPlayer.PlayerGui.blackScreenOnDeath
ui.Enabled = true
wait(3)
local uiTween = tweenServ:Create(ui.Frame, TweenInfo.new(3), {BackgroundTransparency = 1})
uiTween:Play()
uiTween.Completed:Wait()
ui.Enabled = false
ui.BackgroundTransparency = 0 --reset back to visible
end)
I want a black screen to appear when I die and fade away shortly after I respawn.
I’m trying to tween the background transparency from 0 to 1.
When I die, the black screen appears, but no tweening happens, and the black screen never disappears. What did I do wrong?
im fairly certain that just adding more stuff to the tweeninfo isnt gonna work, considering leaving it blank just assigns it roblox’s default but i guess ill try anyways
the issue was because i had the script in startercharacterscripts meaning it resets the script when your player dies, meaning the script stopped before the tween could begin
just adjusted it a little and moved it to startergui and were good