Line 10 is the error. I do not know what is wrong. Websites will not help along with videos.
local gun = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local origin = gun.Handle.Position
local direction = mouse.Hit.LookVector
local remoteEvent = gun:WaitForChild("Gun1RemoteEvent")
remoteEvent.OnClientEvent:Connect(function()
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {gun, origin}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local result = workspace:Raycast(origin, direction)
if result then
local humanoid = result.Instance:FindFirstChild("Humanoid")
if humanoid then
humanoid:TakeDamage(10)
end
end
end)