Problem with textlabels dissapearing after the player dies

Hello. I have a arrest system and it works fine buti wanted to add a arrest logs menu to see who arrested who, why and for how long. And that all works perfectly fine, except for one small issue. If a player resets the arrest log disappears. I’d like it to stay even if the player dies.

LocalScript inside my frame.

local events = game.ReplicatedStorage.RemoteEvents
local arrestLogEvent = events.LogArrestEvent
local exampleLog = script.Parent.ArrestExample
local logsFrame = script.Parent.ArrestLogs

local logCount = 0

local arrestLogsStorage = game.ServerStorage.ArrestLogsStorage


arrestLogEvent.OnClientEvent:Connect(function(cuffedPlayer, ArrestTime, arrestingOfficer, reasons)
	if #logsFrame:GetChildren() == 85 then
		for _, child in pairs(logsFrame:GetChildren()) do
			if child:IsA("TextLabel") then
				child:Destroy()
			end
		end
		logCount = 0
	end

	local newLog = exampleLog:Clone()
	newLog.Parent = logsFrame
	logCount = logCount + 1
	newLog.Name = "ArrestLog_" .. cuffedPlayer.Name .. "_" .. logCount
	newLog.Text = arrestingOfficer .. " Arrested " .. cuffedPlayer.Name
	newLog.Visible = true

	local infoFrame = script.Parent.InfoFrame
	infoFrame.ArrestTimeText.Text = os.date("%Y-%m-%d %H:%M:%S", os.time())
	infoFrame.ReasonsText.Text = table.concat(reasons, ", ") -- Concatenate reasons
	infoFrame.TimeGivenText.Text = ArrestTime .. " seconds"
end)

Disable this

1 Like

Thank you so much bro. This worked!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.