System Message OnTouch

Does anybody know how to make a script that when you touch it it says in chat “[System]: {playerName} has touched the part!”? Thanks!

script.Parent.Touched:Connect(function(Touched)
	local Humanoid = Touched.Parent:FindFirstChildWhichIsA("Humanoid")
	local Debounce = true
	if Humanoid then
		if Debounce then
			Debounce = false
			
			--The Message Thingy, Maybe Just Convert To Chat
			print("[System]: "..Humanoid.Parent.Name.."has touched the"..script.Parent.Name)
			
			
			Debounce = true
		end
	end
end)

Why are you debouncing if there’s no delay anyway?

1 Like

just for sure eh he might had a delay on his function to make it message on the chat xD yep mb

You might want to look up:

https://developer.roblox.com/en-us/api-reference/event/BasePart/Touched
and
As already posted on this thread by @AusRin0177
https://developer.roblox.com/en-us/articles/Lua-Chat-System