PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Using Chat Events in Play Solo

Using Chat Events in Play Solo

Jan 30 2019, 4:14 PM PST

Problem

You want to test a script that uses the Chatted event in Solo.

Solution

Use a StringValue with the .Changed event.

local p = game.Players.Player
Workspace.Value.Changed:Connect(function(msg)
	-- etc...
end)

Discussion

You may have noticed that in Solo testing, there is no area where you can type to test scripts that involve the Chatted event. Therefore instead of doing:

game.Players.PlayerAdded:Connect(function(p)
	p.Chatted:Connect(function(msg)
		-- etc...
	end)
end)

We could use the code posted in the solution. So when you change the StringValue’s value, it will simulate the Chatted event.

Note: You could also use the Player object’s SetSuperSafeChat method, with false for argument. Doing this will make the chat bar appear.

game.Players.Player:SetSuperSafeChat(false)
Tags:
  • chat
  • input
  • coding
  • scripts