First of all, you have this line:
event.OnClientEvent:Connect(function(clientEvent)
Secondly you call Connect a second time here:
event.OnClientEvent:Connect(clientEvent) -- this is the problematic line
I don’t really understand what you’re trying to do there with “clientEvent”. Did you mistype the script, because, I see nothing that would produce an “unknown symbol” error if you typed it correctly.
Are you trying to define your function like this?:
event.OnClientEvent:Connect(function clientEvent()
If so, you can’t do this, because its sort of like doing this, which would be invalid:
event.OnClientEvent:Connect(clientEvent = function()
Instead, if you want your function to have a name you should do this:
function clientEvent()
-- Stuff
end
event.OnClientEvent:Connect(clientEvent)
Otherwise, you can do this to create an anonymous (unnamed) function:
event.OnClientEvent:Connect(function()
-- Stuff
end)
You can’t both name a function, and pass it as an argument at the same time, you can only do either or.
(Also, tip, you can also locally define functions like this)
local function functionName()
end
-- Which is the same as
local functionName = function()
end