mouse.KeyDown:connect(function(key) a nil value?
Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.
:1850: attempt to index local 'mouse' (a nil value)
line 1850
the thing down here is line 1850
mouse.KeyDown:connect(function(key)