How do you go about fixing a local mouse which is (nil)?
Asked by
5 years ago Edited 5 years ago
attempt to index local 'mouse' (a nil value)
Error on line 2422
Came up into my output when I ran a script.
These are whats used.
1 | local Player = game.Players.RandomPlayerNameHere |
2 | local mouse = Player:GetMouse() |
Then skip to line 2422 (where the error is):
01 | mouse.KeyDown:connect( function (key) |
02 | if key = = "z" and attack = = false then |
09 | mouse.KeyDown:connect( function (key) |
10 | if key = = "x" and attack = = false then |
17 | mouse.KeyDown:connect( function (key) |
20 | if autofind = = false then |
And I have 0 clue as to what I've done wrong.
If you need to see any other parts of the script I'd be happy to oblige.
Any ideas as to how to fix this is appreciated.