Custom Clothing not showing when player resets, looking for a work-around to this problem

So I’m trying to make a custom clothing script, for every player they will wear the same clothes, the problem is I don’t know how to put the clothes back on the player even after they die.

Current Code:

local SCRIPT_EVENT = script.Event

local PantsTemplate = 'rbxassetid://163869365'
local ShirtTemplate = 'rbxassetid://237076344'

SCRIPT_EVENT.Event:Connect(function(plyr)
	plyr.CharacterAdded:Wait()
	local Character = plyr.Character
	if Character:FindFirstChild('Pants') then
		Character:FindFirstChild('Pants').PantsTemplate = PantsTemplate
	else if not Character:FindFirstChild('Pants') then
			local Pants = Instance.new("Pants")
			Pants.Name = 'Pants'
			Pants.Parent = Character
			Pants.PantsTemplate = PantsTemplate
		end
	end
	if Character:FindFirstChild('Shirt') then
		Character:FindFirstChild('Shirt').ShirtTemplate = ShirtTemplate
	else if not Character:FindFirstChild('Shirt') then
			local Shirt = Instance.new("Shirt")
			Shirt.ShirtTemplate = ShirtTemplate
			Shirt.Parent = Character
			Shirt.Name = 'Shirt'
		end
	end
	local Humanoid = Character:FindFirstChild('Humanoid')
	Humanoid.Died:Connect(function()
		-- Don't know what to do here
	end)
end)
1 Like
local SCRIPT_EVENT = script.Event

local PantsTemplate = '163869365'
local ShirtTemplate = '237076344'

SCRIPT_EVENT.Event:Connect(function(plyr)
	plyr.CharacterAdded:Wait()
	local Character = plyr.Character
	local HumanoidDesc = Character:WaitForChild("Humanoid"):GetAppliedDescription()

	HumanoidDesc.Pants = PantsTemplate
	HumanoidDesc.Shirt = ShirtTemplate

	if not Character:FindFirstChildWhichIsA("Shirt") then
		Instance.new("Shirt", Character)
	end
	if not Character:FindFirstChildWhichIsA("Pants") then
		Instance.new("Pants", Character)
	end

	task.wait()

	Character.Humanoid:ApplyDescription(HumanoidDesc)	
end)

edit: I forgor that humanoid desc reset mb…

1 Like