Death screen gui not replaying

I have a simple death screen GUI that works just as intended, but it only plays once is there a way to go around this?

I have both scripts inside of the starter GUI, one just in the GUI itself, and another inside of a button

Setup of all elements of GUI and scripts:

image

Video of example:

script of the GUI opening

local TS = game:GetService("TweenService")

local Players = game:GetService("Players")

local player = game:GetService("Players").LocalPlayer

local Character = player.Character or player.CharacterAdded:Wait()

local Humanoid = Character:WaitForChild("Humanoid")

local GUI = script.Parent

local Frame = GUI.Frame

local Retry = GUI.Retry

local Title = GUI.DeathTitle

local close = Retry.Close

Humanoid.Died:Connect(function()

Players.RespawnTime = 9435867548936589474389567

Retry.Close.Disabled = true

Frame:TweenPosition(UDim2.new(0,0,1,0),

Enum.EasingDirection.Out,

Enum.EasingStyle.Quint,

.75

)

wait(4)

Title:TweenPosition(UDim2.new(0.273,0,0.052,0),

Enum.EasingDirection.Out,

Enum.EasingStyle.Quad,

3

)

wait(5)

Retry:TweenPosition(UDim2.new(0.439,0,0.809,0),

Enum.EasingDirection.InOut,

Enum.EasingStyle.Quad,

1

)

wait(1.25)

Retry.Close.Disabled = false

end)

Code of the closing GUI, when i click the “RETRY” button


local TS = game:GetService("TweenService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local GUI = script.Parent.Parent
local Frame = GUI.Frame
local Retry = GUI.Retry
local Title = GUI.DeathTitle

Retry.MouseButton1Click:Connect(function()
	Retry:TweenPosition(UDim2.new(0.439,0,1.1,0),
		Enum.EasingDirection.InOut,
		Enum.EasingStyle.Quint,
		1
	)
	wait(.25)
	Title:TweenPosition(UDim2.new(0.272,0,-0.5,0),
		Enum.EasingDirection.InOut,
		Enum.EasingStyle.Quad,
		1.5
	)
	wait(1)
	Players.RespawnTime = 1.0
	wait(1)
	Frame:TweenPosition(UDim2.new(0,0,-0.1,0),
		Enum.EasingDirection.In,
		Enum.EasingStyle.Quint,
		.75
	)
end)

I tried other things to make it work, and I saw one using functions, can I use that too? If not, then i can use a different type of death GUI, but I still feel like the death problem will still arise (If you die once and get the GUI, it wont work after)

Is there anything I could do that can help?

Thanks

Does checking Reset on Spawn in the main GUI help?

After rewiring some of the code, and changing the reset thingy and editing the frames it worked

Thanks

1 Like