local part = script.Parent
if game.PurpleKey.ClickDetector.MouseClick:Connect(function(plr) keyModule.Clicked = true wait(1) part:remove()
if game.PurpleKey.ClickDetector.MouseClick:Connect(function(plr)
keyModule.Clicked = false wait(1) part:add()
end
end
In Lua, when you are connecting a function in that way ':Connect(function()' you have to put a closing bracket after the end. It closes the opening bracket that is before the word 'function', and thus closes the function.