Emote dosent work when i use /e tvtime

So im making a Eternal Towers Of Hell fangame, and i made a emote

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local LocalPlayer = Players.LocalPlayer
local animationId = "rbxassetid://99759198189491"
local command = "/e tvtime"

local playing = false
local currentTrack = nil
local lastPosition = nil

local function stopAnimation()
	if currentTrack then
		currentTrack:Stop()
		currentTrack = nil
	end
	playing = false
	lastPosition = nil
end

local anim = Instance.new("Animation")
anim.AnimationId = animationId

LocalPlayer.Chatted:Connect(function(message)
	if message:lower() == command then
		local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
		local humanoid = character:FindFirstChildOfClass("Humanoid")
		local animator = humanoid:FindFirstChildOfClass("Animator") or humanoid:WaitForChild("Animator")

		stopAnimation()

		currentTrack = animator:LoadAnimation(anim)
		currentTrack.Looped = true
		currentTrack:Play()
		playing = true

		local rootPart = character:WaitForChild("HumanoidRootPart")
		lastPosition = rootPart.Position
	end
end)

RunService.RenderStepped:Connect(function()
	if playing then
		local character = LocalPlayer.Character
		if character then
			local rootPart = character:FindFirstChild("HumanoidRootPart")
			if rootPart and lastPosition then
				local currentPosition = rootPart.Position
				if (currentPosition - lastPosition).Magnitude > 0.01 then
					stopAnimation()
				else
					lastPosition = currentPosition
				end
			end
		end
	end
end)

but whenever i do /e tvtime on chat it says only r15 is allowed to emote on the chat, it takes a couple of tries until it works, but its not supposed to be like that and its meant to do the emote when i chat /e tvtime

try this

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local LocalPlayer = Players.LocalPlayer
local animationId = "rbxassetid://99759198189491"
local command = "!tvtime" -- changed from "/e tvtime"

local playing = false
local currentTrack = nil
local lastPosition = nil

local function stopAnimation()
	if currentTrack then
		currentTrack:Stop()
		currentTrack = nil
	end
	playing = false
	lastPosition = nil
end

local anim = Instance.new("Animation")
anim.AnimationId = animationId

LocalPlayer.Chatted:Connect(function(message)
	if message:lower() == command then
		local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
		local humanoid = character:FindFirstChildOfClass("Humanoid")
		local animator = humanoid:FindFirstChildOfClass("Animator") or humanoid:WaitForChild("Animator")

		stopAnimation()

		currentTrack = animator:LoadAnimation(anim)
		currentTrack.Looped = true
		currentTrack:Play()
		playing = true

		local rootPart = character:WaitForChild("HumanoidRootPart")
		lastPosition = rootPart.Position
	end
end)

RunService.RenderStepped:Connect(function()
	if playing then
		local character = LocalPlayer.Character
		if character then
			local rootPart = character:FindFirstChild("HumanoidRootPart")
			if rootPart and lastPosition then
				local currentPosition = rootPart.Position
				if (currentPosition - lastPosition).Magnitude > 0.01 then
					stopAnimation()
				else
					lastPosition = currentPosition
				end
			end
		end
	end
end)

edited this try it now it should work

Nope, it still dosent work, maybe its not the command but maybe something else.

what i done is changed this are u sure its not working

local command = "!tvtime" -- changed from "/e tvtime"

ye i typed !tvtime and it did nothing

is there any errors in the output

no there nothing on the output

Roblox intercepts /e so use custom prefix like !tvtime
R15-only emote error caused by default /e system
Unreliable triggering so avoid /e, use your own trigger

I just changed it so its “/se tvtime” but it has no difference

its maybe the animation issue u might need to reupload it

before this i reuploaded the animation and repalced the animation id with the reuploaded one

right is it a local script and where is the script placed

its a local script and placed in starter player scripts

could u trying using this to print to see if its actually working bc if it doesnt then its either the player is nil or something else

LocalPlayer.Chatted:Connect(function(message)
	print("You typed:", message)
end)

it dosent print anything when i typed the command

maybe try this

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local LocalPlayer = Players.LocalPlayer
local command = "!tvtime"
local animationId = "rbxassetid://507771019" -- replace with your own

local anim = Instance.new("Animation")
anim.AnimationId = animationId

local playing = false
local currentTrack = nil
local lastPosition = nil

local function stopAnimation()
	if currentTrack then
		currentTrack:Stop()
		currentTrack = nil
	end
	playing = false
end

LocalPlayer.Chatted:Connect(function(message)
	if message:lower() == command then
		local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
		local humanoid = character:WaitForChild("Humanoid")
		local animator = humanoid:FindFirstChild("Animator")

		stopAnimation()

		if animator then
			currentTrack = animator:LoadAnimation(anim)
		else
			currentTrack = humanoid:LoadAnimation(anim)
		end

		currentTrack.Looped = true
		currentTrack:Play()
		playing = true

		lastPosition = character:WaitForChild("HumanoidRootPart").Position
	end
end)

RunService.RenderStepped:Connect(function()
	if playing then
		local character = LocalPlayer.Character
		if character then
			local rootPart = character:FindFirstChild("HumanoidRootPart")
			if rootPart and lastPosition then
				local currentPosition = rootPart.Position
				if (currentPosition - lastPosition).Magnitude > 0.01 then
					stopAnimation()
				else
					lastPosition = currentPosition
				end
			end
		end
	end
end)

try this also lmk if anything prints

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer or Players.PlayerAdded:Wait()

print("LocalPlayer found:", LocalPlayer.Name)

LocalPlayer.Chatted:Connect(function(message)
    print("Chat detected:", message)
end)

This issue can happen if you’re using the new TextChatService, which does not support player.Chatted that was part of the legacy chat system.

Using TextChatService, the new method looks like this:

local TextChatService = game:GetService("TextChatService")

TextChatService.OnIncomingMessage = function(message)
-- message.Text, message.TextSource, message.TextChannel, etc
end

The function receives a TextChatMessage object that contains properties such as:

  • Text - the message that was sent
  • TextSource - who sent it
  • TextChannel - where it was sent ( “RBXSystem” ← for /e )
  • Status - whether the message was filtered or successful

You can find the full documentation here:

Thanks, it works now, i also made it so it can do multiple but i dont have the emote id yet

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TextChatService = game:GetService("TextChatService")

local LocalPlayer = Players.LocalPlayer

local Emotes = {
	["!tvtime"] = "rbxassetid://99759198189491",
	--["!griddy"] = "rbxassetid://507771019",
	--["!paranormals"] = "rbxassetid://507768133",
	--["!paranormalswagtivity"] = "rbxassetid://507768133",
	--["!ps"] = "rbxassetid://507768133",
}

local currentTrack = nil
local playing = false
local lastPosition = nil

local function stopAnimation()
	if currentTrack then
		currentTrack:Stop()
		currentTrack = nil
	end
	playing = false
	lastPosition = nil
end

local function playEmote(animId)
	local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	local animator = humanoid and (humanoid:FindFirstChildOfClass("Animator") or humanoid:WaitForChild("Animator"))

	if not animator then return end

	stopAnimation()

	local anim = Instance.new("Animation")
	anim.AnimationId = animId
	currentTrack = animator:LoadAnimation(anim)
	currentTrack.Looped = true
	currentTrack:Play()

	local rootPart = character:WaitForChild("HumanoidRootPart")
	lastPosition = rootPart.Position
	playing = true
end

TextChatService.OnIncomingMessage = function(message)
	if message.TextSource then
		local speaker = Players:GetPlayerByUserId(message.TextSource.UserId)
		if speaker == LocalPlayer then
			local text = message.Text:lower()

			local animId = Emotes[text]
			if animId then
				playEmote(animId)

				local channel = message.Metadata and message.Metadata.Channel
				if channel then
					local msgObj = TextChatService:FindFirstChild(channel)
					if msgObj then
						msgObj:DisplaySystemMessage("")
					end
				end
			end
		end
	end
end

RunService.RenderStepped:Connect(function()
	if playing then
		local character = LocalPlayer.Character
		if character then
			local rootPart = character:FindFirstChild("HumanoidRootPart")
			if rootPart and lastPosition then
				local currentPosition = rootPart.Position
				if (currentPosition - lastPosition).Magnitude > 0.01 then
					stopAnimation()
				else
					lastPosition = currentPosition
				end
			end
		end
	end
end)