I made a simple script to be used to toggle korblox & headless in your games.
When a user toggles headless or korblox off, it will reset their head/leg to their current one they are wearing, unless it is headless/korbox, then it will reset to the default head/leg.
--> Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--> remotes
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Headless = Remotes:WaitForChild("Headless")
local Korblox = Remotes:WaitForChild("Korblox")
--> Assets
local Assets = {
["Headless"] = 134082579,
["Korblox"] = 139607718,
["Default"] = 0,
}
--> Functions
local function GetDescription(player: Player): HumanoidDescription
return Players:GetHumanoidDescriptionFromUserId(player.UserId)
end
local function GetDescriptionFromCharacter(player: Player): HumanoidDescription
local Character = player.Character
if not Character then return GetDescription(player) end
local Humanoid: Humanoid = Character:WaitForChild("Humanoid", 1)
local Desc = Humanoid:GetAppliedDescription()
return Desc
end
local function GetPlayerDefaultHead(player: Player)
local Description: HumanoidDescription = GetDescription(player)
local Head = Description.Head
if Head == Assets["Headless"] then
return Assets["Default"]
else
return Head
end
end
local function GetPlayerDefaultLeg(player: Player)
local Description: HumanoidDescription = GetDescription(player)
local Leg = Description.RightLeg
if Leg == Assets["Korblox"] then
return Assets["Default"]
else
return Leg
end
end
local function OnHeadless(player: Player, value: boolean)
if value == true then
local Character = player.Character
if not Character then return end
local Humanoid: Humanoid = Character:WaitForChild("Humanoid", 1)
local newDesc = GetDescriptionFromCharacter(player)
newDesc.Head = Assets["Headless"]
Humanoid:ApplyDescription(newDesc)
elseif value == false then
local Character = player.Character
if not Character then return end
local Humanoid: Humanoid = Character:WaitForChild("Humanoid", 1)
local newDesc = GetDescriptionFromCharacter(player)
newDesc.Head = GetPlayerDefaultHead(player)
Humanoid:ApplyDescription(newDesc)
end
end
local function OnKorblox(player: Player, value: boolean)
if value == true then
local Character = player.Character
if not Character then return end
local Humanoid: Humanoid = Character:WaitForChild("Humanoid", 1)
local newDesc = GetDescriptionFromCharacter(player)
newDesc.RightLeg = Assets["Korblox"]
Humanoid:ApplyDescription(newDesc)
elseif value == false then
local Character = player.Character
if not Character then return end
local Humanoid: Humanoid = Character:WaitForChild("Humanoid", 1)
local newDesc = GetDescriptionFromCharacter(player)
newDesc.RightLeg = GetPlayerDefaultLeg(player)
Humanoid:ApplyDescription(newDesc)
end
end
--> Connections
Headless.OnServerEvent:Connect(OnHeadless)
Korblox.OnServerEvent:Connect(OnKorblox)
You will need to create a local script that fires the remotes to toggle the headless and korblox.