Expected 'then', got <eof>

Hello, today I’ve been having a problem with scripting.
This is my code:

local ChatService = game:GetService("Chat")
local talk = script.Parent

if game.Workspace.floor.Touched:Connect(function() then
		do
			ChatService:Chat(talk, "test", "Red")
		end
	end) 

The issue is:

image

I have no idea what is wrong, I try removing and adding end or end) but nothing happens…
I did add then so it makes no sense to me.

I need help. Thanks in advance!

You should remove the if else statement completely since that is a function

local ChatService = game:GetService("Chat")
local talk = script.Parent

game.Workspace.floor.Touched:Connect(function()
			ChatService:Chat(talk, "test", "Red")
	end) 
4 Likes