I know that when you're in a function or a loop or a conditional, you have to use locals. What I don't understand is when people do something like
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local camera = workspace.CurrentCamera
repeat wait() until player.Character
local char = player.Character
What does "local" mean there? There's no functions, no loops, no conditionals, you're just setting those variables in the beginning of your script.

2 comments
Right there it does nothing. If you used those variables in the script to do something, it's pretty much a way of cutting down long pieces of code into small pieces. It makes the script shorter when using those variables longer and you only have to type the long version once.
Local extends it to one function or the contained function, usually. Without local, it is global to the whole script.