the message wont appear in workspace

local deBounce = false
local playerFrom = game.Players.LocalPlayer
local ChatService = game:GetService("Chat")
script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") == true then
		ChatService.Chatted:Connect(function(message)
			deBounce = true
			local FilteredString = game:GetService("Chat"):FilterStringForBroadcast(message, playerFrom)
			local Message = Instance.new("Message")
			Message.Parent = workspace
			Message.Text = FilteredString
			wait(3)
			deBounce = false
			Message.Parent = nil
			Message.Text = ""
		end)
	end
end)

3 comments

0

You need to do this on a server script if I'm right, the 8th line fails I think.

0

It is on a server script

0

Accessing the LocalPlayer isn't possible on a ServerScript, only LocalScripts.