ServerRemoteScript keep saying attempt to index nil with ''any codeline''

So my script basically works like this.

The player has a mouse.hit script, when it hits a model with humanoid it links the objectvalue to it.
It will have the object value linked to it.
So i make it fire the remote.
And the server script was like ObjectValue.Value.Humanoid.Health:TakeDamage(50)
now i have tried with like FindFirstChild, WaitForChild.

Any solutions?

also to mention that mouse.hit script is local.
So what did i do wrong?

Could you show us your script? It would help us.

ObjectValue Script (local):
local player = game.Players.LocalPlayer
mouse = player:GetMouse()
while wait(0.1) do
if mouse.Target ~= nil then
local model = mouse.Target.Parent
script.Enabled.Value = false
script.HumanoidTarget.Value = nil
if model:FindFirstChildOfClass(“Humanoid”) then
script.Enabled.Value = true
print (“Pointing at a model with Humanoid”)

		print (model.Torso.Position)
		local humanoid = script.HumanoidTarget
		humanoid.Value = model
	end
end

end

Server Remote Fire Script (local):
local UserInputService = game:GetService(“UserInputService”)

– A sample function providing one usage of InputBegan
local function onInputBegan(input, gameProcessed)
if Enum.UserInputType.MouseButton1 and script.Parent.SniperCrewTarget.Enabled.Value == true then
print(“The left mouse button has been pressed!”)
game.ReplicatedStorage.ShootInv:FireServer()
end
end

UserInputService.InputBegan:Connect(onInputBegan)

ServerScriptService script:
game.ReplicatedStorage.ShootInv.OnServerEvent:Connect(function(player, humanoid)
local ui = player.PlayerGui:WaitForChild(“Squad”)
wait(0.001)
local hum = humanoid:WaitForChild(‘Humanoid’)
if hum then
hum:TakeDamage(100)
end
end)