Gui Button stops working after player respawn

Should I share that script as well?

Tried enable/disable, still nothing :confused:

Actually, wait! I left it enabled and it seems to work after

AMX13F3AM: It does work now! should all screen guis have this option enabled? Also, please join my group so you can be paid. 1k robux good for you?

The property is based on your purpose of the ScreenGui. If it’s a Death Screen, the that property should be false unless you have a script to toggle Visible property.

I don’t think you can do payment in public post. If you want, continue in Private Messages.

1 Like

Btw please mark my replies as “Solution” so developers can refer to that after.

1 Like
local Replicated = game:GetService("ReplicatedStorage")
local Event = Replicated:WaitForChild("dofacENC")
local Animation = Replicated:WaitForChild("dofac")

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local Track = Animator:LoadAnimation(Animation)

local Button = script.Parent

local Debounce = false

Button.MouseButton1Click:Connect(function()
	if Debounce then return end
	Debounce = true
	if Track.IsPlaying then
		Track.Stopped:Wait()
	end
	Track:Play()
	Event:FireServer()
	
	for i = 10, 1, -1 do
		Button.Text = i
		task.wait(1)
	end
	Button.Text = Button.Name
	Debounce = false		
end)

Couple of issues with the provided solutions so I decided to write one myself. You can keep the ResetOnSpawn property enabled too.

Move the animation to the ReplicatedStorage folder with the RemoteEvent instance.

Thank you for improving the script!