Quick question about a script real quick

So I am looking at a script and they did something that confused me. I am going to show you an example of what they did and I was just wondering if you can help me understand this.

What they basically did

script 1(local script that is firing an event)

local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local playerCharacter = player.Character
local Event = tool:WaitForChild("OnShoot")
local playerMouse = player:GetMouse()


script.Parent.Activated:Connect(function(mouse)
	Event:FireServer(mouse.Hit)
end)

script 2(a script that is going to see when the remote event is fired)

local tool = script.Parent
local Event = tool:WaitForChild("OnShoot")

Event.OnServerEvent:Connect(function(player, Mousehit)
	
end)

So when the local script fired the event and it looks like they made a mouse parameter and said “mouse.Hit” or pretty much sending to the server script what the mouse clicked on. And then it looks like the server script picked up the mouse hit and then it also said “player” player with it. or like this (player, Mousehit) and I was wondering how they can do that and why?

If I’m understanding your question correctly you’re wondering why the script needs to include the “player” parameter. When you fire a remote event from a LocalScript. A local script as the name implies is a script mainly used with the local player or the user who is currently on. When you fire the remote event essentially it’s like a invisible parameter being sent. This invisible parameter is the current player that did something to activate the event.

-- Local script
RemoteEvent:FireServer(var)
-- is fired from a local script and can be received as this on a script
-- Script
RemoteEvent.OnServerEvent(playerWhoSent, varSent)

More info on remote events can be found here. Hope this helps.