How to make a Korblox Leg back to player's default leg

Im trying to figure it out but, any help is appreicated.

local SettingsEvent = game.ReplicatedStorage.SettingsEvent

SettingsEvent.OnServerEvent:Connect(function(player, SettingType, boolean)
	if SettingType == "Korblox" then
		local Humanoid = player.Character:FindFirstChild("Humanoid")	
		
		if boolean then
			local descriptionClone = Humanoid:GetAppliedDescription()
			
			descriptionClone.RightLeg = 139607718
			Humanoid:ApplyDescription(descriptionClone)
		else
			--Trying to figure it out
		end
	end
end)
1 Like

Have an array with each value being the player’s old leg that gets set before changing the leg
Make sure the old leg isn’t the korblox leg id though.

local PlayerLegs = {

}

SettingsEvent.OnServerEvent:Connect(function(player, SettingType, boolean)
	if SettingType == "Korblox" then
		local Humanoid = player.Character:FindFirstChild("Humanoid")	
		
		if boolean then
			local descriptionClone = Humanoid:GetAppliedDescription()
			PlayerLegs[Player] = descriptionClone.RightLeg -- Save old leg (add check to make sure its not a korblox leg)
			descriptionClone.RightLeg = 139607718
			Humanoid:ApplyDescription(descriptionClone)
		else
			if PlayerLegs[Player] then
               -- Apply old leg to character
            end
		end
	end
end)
1 Like

image
I changed one of my scripts but it says this

local SettingsEvent = game.ReplicatedStorage.SettingsEvent

local PlayerLegs = {

}

SettingsEvent.OnServerEvent:Connect(function(player, SettingType, boolean)
	if SettingType == "Korblox" then
		local Humanoid = player.Character:FindFirstChild("Humanoid")	
		
		if boolean then
			local descriptionClone = Humanoid:GetAppliedDescription()
			PlayerLegs[player] = descriptionClone.RightLeg
			descriptionClone.RightLeg = 139607718
			Humanoid:ApplyDescription(descriptionClone)
		else
			if PlayerLegs[player] then
				local descriptionClone = Humanoid:GetAppliedDescription()
				descriptionClone.RightLeg = PlayerLegs[player.UserId]
				Humanoid:ApplyDescription(PlayerLegs[player])
			end
		end
	end
end)

This is because youre using the userid to index the playerlegs array instead of the actual player object. In Humanoid:ApplyDescription if the boolean is false you have to pass in the description and not the leg id.

1 Like

Can you send me the fixed script?

I don’t like to spoonfeed since you don’t learn anything from it, you just have to set the descriptionClone’s right leg in the else block to use the player object instead of userid and Humanoid:ApplyDescription to use the description clone.

1 Like

Delete all CharacterMesh instances inside the character.

You should keep a copy of the original HumanoidDescription and just take the leg id from there once the player wants to revert it

1 Like