Free Chat Commands Script

New Chat Commands Script

Hey everyone!

As many developers are still getting used to the new TextChatService, my friend and I created this script to help you integrate custom chat commands into your game. This script includes six useful commands that can enhance your hangout games, roleplay experiences, and more.

Features

This script adds the following commands:
:white_check_mark: /headless – Removes your character’s head.
:white_check_mark: /korblox – Applies the Korblox right leg.
:white_check_mark: /stitch – Changes your face to the “Stitch” face.
:white_check_mark: /sit – Makes your character sit.
:white_check_mark: /refresh – Respawns your character while keeping the same position.


Installation

  1. Download the script file below.
  2. Drag and drop it into ServerScriptService in Roblox Studio.
  3. That’s it! Your commands will be ready to use.

Download

Download


Breakdown of the Script:

  1. Services and Variables
local Newchat = game:GetService("TextChatService")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local TextChatCommands = Newchat:WaitForChild("TextChatCommands")

local Prefixs = { "/" }
  • TextChatService is used to handle chat commands.
  • MarketplaceService is included but not used.
  • Players service is used to get player data.
  • TextChatCommands is a container for custom chat commands.
  • Prefixs defines command prefixes (only / is used).
  1. Function to Find a Player by User ID
local function GetPlayerByID(ID)
	local GotPlayer = nil
	for _, User in pairs(Players:GetPlayers()) do
		if User.UserId == ID then
			GotPlayer = User
			break
		end
	end
	return GotPlayer
end
  • Loops through all players and returns the one with a matching UserId.

3. Command Functions

Each command modifies the player’s avatar or behavior. The function receives:

  • Text_O: The TextSource (who sent the command).
  • MSG: The message text (unused in this script).

Headless Command (/headless)

["headless"] = function(Text_O : TextSource, MSG : string)
	local User : Player = GetPlayerByID(Text_O.UserId)
	if User then
		local Character = User.Character
		if (Character) and Character.Parent then
			local Humanoid = Character:FindFirstChildOfClass("Humanoid")
			if (Humanoid) and Humanoid.Health > 0 then
				local humanoidDescription = Humanoid:GetAppliedDescription()
				humanoidDescription.Head = 15093053680
				Humanoid:ApplyDescription(humanoidDescription)
			end
		end
	end
end,
  • Removes the player’s head by applying a custom HumanoidDescription with Head = 15093053680.

Korblox Command (/korblox)

["korblox"] = function(Text_O : TextSource, MSG : string)
	local User : Player = GetPlayerByID(Text_O.UserId)
	if User then
		local Character = User.Character
		if (Character) and Character.Parent then
			local Humanoid = Character:FindFirstChildOfClass("Humanoid")
			if (Humanoid) and Humanoid.Health > 0 then
				local humanoidDescription = Humanoid:GetAppliedDescription()
				humanoidDescription.RightLeg = 139607718
				Humanoid:ApplyDescription(humanoidDescription)
			end
		end
	end
end,
  • Changes the player’s right leg to the Korblox leg (RightLeg = 139607718).

Stitch Face Command (/stitch)

["stitch"] = function(Text_O : TextSource, MSG : string)
	local User : Player = GetPlayerByID(Text_O.UserId)
	if User then
		local Character = User.Character
		if (Character) and Character.Parent then
			local Humanoid = Character:FindFirstChildOfClass("Humanoid")
			if (Humanoid) and Humanoid.Health > 0 then
				local humanoidDescription = Humanoid:GetAppliedDescription()
				humanoidDescription.Face = 8329679
				Humanoid:ApplyDescription(humanoidDescription)
			end
		end
	end
end,
  • Changes the player’s face to the Stitch face (Face = 8329679).

Sit Command (/sit)

["sit"] = function(Text_O : TextSource, MSG : string)
	local User : Player = GetPlayerByID(Text_O.UserId)
	if User then
		local Character = User.Character
		if (Character) and Character.Parent then
			local Humanoid = Character:FindFirstChildOfClass("Humanoid")
			if (Humanoid) and Humanoid.Health > 0 then
				Humanoid.Sit = true
			end
		end
	end
end,
  • Forces the player’s character to sit (Humanoid.Sit = true).

Refresh Command (/refresh)

["refresh"] = function(Text_O : TextSource, MSG : string)
	local User : Player = GetPlayerByID(Text_O.UserId)
	if User then
		local Character = User.Character
		if (Character) and Character.Parent then
			local Humanoid = Character:FindFirstChildOfClass("Humanoid")
			if (Humanoid) and Humanoid.Health > 0 then
				local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
				if not HumanoidRootPart then 
					return 
				end
				local LastCf = HumanoidRootPart.CFrame
				local API = pcall(User.LoadCharacter, User)
				if API == true then
					task.wait()
					Character = User.Character
					local Humanoid = Character:WaitForChild('Humanoid', 5)
					local HumanoidRootPart = Character:WaitForChild('HumanoidRootPart', 5)
					local ForceField = Character:FindFirstChild("ForceField")
					if ForceField then 
						ForceField:Destroy()
					end
					if HumanoidRootPart then
						HumanoidRootPart.CFrame = LastCf
					end
				end
			end
		end
	end
end,
  • Reloads the player’s character while keeping their position.
  • Saves the CFrame of HumanoidRootPart, then calls User:LoadCharacter().
  • After respawning, moves the character back to the saved position.
  1. Creating and Registering Commands
for Name, func in pairs(Commands) do
	local New_Command = Instance.new("TextChatCommand")
	New_Command.Name = "Command: " .. Name
	New_Command.PrimaryAlias = Prefixs[1] .. Name
	New_Command.AutocompleteVisible = true
	New_Command.Triggered:Connect(func)
	New_Command.Parent = TextChatCommands
end
  • Loops through Commands and creates a TextChatCommand for each.
  • Sets:
    • PrimaryAlias: The command prefix + name (e.g., /headless).
    • AutocompleteVisible: Shows the command in chat suggestions.
    • Triggered: Connects the function to execute when the command is used.

Credits

Made by
@Rare_Codin
@Akira_1Dev

4 Likes