How to make command to change character's r6/r15 in chat?

Hi, I’m new for script and I wonder how can I make command to change character r6/r15 in chat like in Catalog Avatar Creator.

Example:

Since you’re new to scripting, I made this script since I have free-time I guess.

You can switch a rigtype of a character by getting the HumanoidDescription of the player by :GetHumanoidDescriptionFromUserId(CharacterAppearanceId) preferably, and you can create a humanoid model by using :CreateHumanoidModelFromDescription() using the HumanoidDescription with the preferred RigType.

This might seem complicated to you since you’re a newbie into scripting, so I advise you to take some tutorials and gain some knowledge from the DevForum. YouTube works aswell but I mostly learnt my knowledge by ROBLOX’s DevForum.

The script may be a bit janky but you can modify it to however you want.

-- Paste this script into ServerScriptService as a "Script" object.
local Prefix = "/" -- Set to whatever prefix you want. (must be in quotation marks)
local Players = game:GetService("Players")
local Debounce = false

local Cooldown = 1.5 -- Set the wait time for every rigtype change.

Players.PlayerAdded:Connect(function(Player) -- Gets the player that joined the server.
	local Character = Player.Character or Player.CharacterAdded:Wait() -- Gets the Character (Model)
	local CurrentRigType = Character.Humanoid.RigType
	Player.Chatted:Connect(function(Msg) -- If the player talks in chat then,
		if string.sub(Msg, 1, 1) == Prefix then -- Checks the first letter of the message and checks if it matches the prefix.
			if not Debounce then Debounce = true -- Disables the command from firing until the cooldown ends.
				if Msg == Prefix.."r6" then  -- If R6 then...
					local Humanoid: Humanoid = Character:WaitForChild("Humanoid") -- Finds the current humanoid with current variables.
					if CurrentRigType == Enum.HumanoidRigType.R15 then -- If the humanoid's rig type isn't in R15 then...
						local Main = game.Players:GetHumanoidDescriptionFromUserId(Player.CharacterAppearanceId)
						local morph = game.Players:CreateHumanoidModelFromDescription(Main, Enum.HumanoidRigType.R6)
						morph:SetPrimaryPartCFrame(Player.Character.PrimaryPart.CFrame)
						morph.Name = Player.Name
						Player.Character = morph
						morph.Parent = workspace
						CurrentRigType = Enum.HumanoidRigType.R6
					end
				end

				if Msg == Prefix.."r15" then
					local Humanoid: Humanoid = Character:WaitForChild("Humanoid") -- Finds the current humanoid with current variables.
					if CurrentRigType == Enum.HumanoidRigType.R6 then -- If the humanoid's rig type isn't in R15 then...
						local Main = game.Players:GetHumanoidDescriptionFromUserId(Player.CharacterAppearanceId)
						local morph = game.Players:CreateHumanoidModelFromDescription(Main, Enum.HumanoidRigType.R15)
						morph:SetPrimaryPartCFrame(Player.Character.PrimaryPart.CFrame)
						morph.Name = Player.Name
						Player.Character = morph
						morph.Parent = workspace	
						CurrentRigType = Enum.HumanoidRigType.R15
					end
				end
				
				task.wait(Cooldown) -- The cooldown wait. 
			    Debounce = false -- Command can be used again.
			end
		end
	end)
end)
1 Like

Thanks you so much for it! And yes it already look complicated tbh. I’m try to be decent script writer that I can make what I want. :wink:

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