Need assistance making script local + working

  1. Goal: Make the original script local and then make the required values work with it.

  2. What is the issue? The script is server sided and can be buggy, meaning when one person dies inside the area and another person is inside they won’t die even if the countdown reaches 0,

  3. What solutions have you tried so far? The script was edited a lot but no solutions are working.

local touching = false
local shouldKill = false

script.Parent.Touched:Connect(function(hit)
	local p = game.Players:GetPlayerFromCharacter(hit.Parent)
	if p then
		local ui = p.PlayerGui.Cold.Frame
		if hit.Parent:FindFirstChildWhichIsA("Humanoid") then
			touching = true
			ui.Visible = true
			if ui.Visible then
				for i = 10, 0, -1 do 
					ui.TextLabel.Text = "Dangerous area turn around! - "..i.."s"
					if not touching then             
						shouldKill = false
						break 
					else
						shouldKill=true
					end
					wait(1)
				end
				if shouldKill then hit.Parent.Humanoid.Health = 0 end
				ui.Visible = false
			else
				ui.TextLabel.Text = "Dangerous area turn around! - 10s"
				ui.Visible = false
			end
		end
	end
end)

script.Parent.TouchEnded:Connect(function()
	touching = false
end)

The script needs the required values of: IsClothed.
The isclothed value is a leaderstat value and works off of getting clothes then gaining the value of 1, 1 = you’re wearing clothes 0 = you’re not wearing clothes. (obviously will be but something warm)

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if game.Players:FindFirstChild(hit.Parent.Name).leaderstats.IsClothed.Value == 0 then