-- Luke



local button = script.Parent
local players = game:GetService('Players')
local characterScripts = game:GetService('ReplicatedStorage'):WaitForChild('CharacterScripts')


local CHARACTER_TEMPLATE = workspace:WaitForChild('Woman')
local DEBOUNCE_TIME = 5
local debounce = false


button.Touched:connect(function(hit)
	if hit and hit.Parent then
		local humanoid = hit.Parent:FindFirstChild('Humanoid')
		local hrp = hit.Parent:FindFirstChild('HumanoidRootPart')
		if hrp and humanoid and humanoid.Health > 0 then
			local player = players:GetPlayerFromCharacter(hit.Parent)
			if not debounce then
				debounce = true
				
				local newCharacter = CHARACTER_TEMPLATE:Clone()
				newCharacter.HumanoidRootPart.CFrame = hrp.CFrame
				newCharacter.HumanoidRootPart.Anchored = false
				newCharacter.Name = player.Name
				
				for i,v in pairs(characterScripts:GetChildren()) do
					v:clone().Parent = newCharacter
				end

				player.Character = newCharacter
				newCharacter.Parent = workspace

				wait(DEBOUNCE_TIME)
				debounce = false
			end
		end
	end
end)




