Script not working

its in a local script in starter gui

game.Players.LocalPlayer.Chatted:Connect(function(Message)
	if Message == "Speed" then
		game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 100
	end
end)

StarterGui? Put it in StarterPlayerScripts.

local Players = game:GetService("Players")

local LocalPlayer = Players.LocalPlayer

LocalPlayer.Chatted:Connect(function(ChatMessage: string)
-- code
end)

Still doesn’t work charsssssssssss

.Chatted
I think only works on the server? I could be wrong. Put this in ServerScriptService

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)
	
	Player.Chatted:Connect(function(Message)
		
		print(Message)
		
		if (Message == "Speed") then
			
			local Character = Player.Character
			Character:WaitForChild("Humanoid").WalkSpeed = 100
			
		end
		
	end)
	
end)

EDIT: Yeah only works on server.

How do you do it clientsided though I remember using .chatted on the client recently and it worked perfectly fine

I just tried. I don’t think its possible. As in the docs its non-client

Also the new TextChatService update literally broke this so using this is completely useless.

Chatted works on Client side, but only if you are not using the new default TextChatService. Make sure you are using the legacy one, or change the approach and read the documentation of TextChatService

What you mean? I just added this in client side and it works:

local Player = game.Players.LocalPlayer
Player.Chatted:Connect(function()
	warn("a")
end)

Looking at the wrong documentation

Forgot there was a Player doc and a Chat doc

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