Getting previous HumanoidDescription and apply it later on

Hello! I’m trying to make a command where if a player says headless, it gives the player the headless head. Then if the player says unheadless, it will return to their normal head that they originally had on their avatar. I’ve tried splitting them into two separate functions and still not working.

helps are appreciated!

local headlessRemote = game:GetService("ReplicatedStorage").Remotes.Headless
headlessRemote.OnServerEvent:Connect(function(player, mode)
	local char = player.Character
	local Humanoid = char:WaitForChild("Humanoid",1)
	local descriptionClone = Humanoid:GetAppliedDescription()

	local prevHead = descriptionClone.Head
	local prevFace = descriptionClone.Face
	
	if mode == "UnHeadless" then
		descriptionClone.Head = descriptionClone.Head
		descriptionClone.Face = descriptionClone.Face
		Humanoid:ApplyDescription(descriptionClone)
	elseif mode == "Headless" then
		descriptionClone.Head = 15093053680
		descriptionClone.Face = 0
		Humanoid:ApplyDescription(descriptionClone)
	end
end)
1 Like
local headlessRemote = game:GetService("ReplicatedStorage").Remotes.Headless

local prevHead = nil
local prevFace = nil

headlessRemote.OnServerEvent:Connect(function(player, mode)
	local char = player.Character
	local Humanoid = char:WaitForChild("Humanoid",1)
	local descriptionClone = Humanoid:GetAppliedDescription()

	if mode == "UnHeadless" then
		descriptionClone.Head = prevHead
		descriptionClone.Face = prevFace
		Humanoid:ApplyDescription(descriptionClone)
	elseif mode == "Headless" then
		prevHead = descriptionClone.Head
		prevFace = descriptionClone.Face

		descriptionClone.Head = 15093053680
		descriptionClone.Face = 0
		Humanoid:ApplyDescription(descriptionClone)
	end
end)
2 Likes

Awesome! Works really well! TYSM!

2 Likes

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