How can i create a bullet effect via beam using this raycast gun?

im trying to make a fast shooting gun so im trying to not launch every remote event everytime its clicked

my raycast gun makes the raycast in a local script where the shot is verified and if its a character it launches a remote event to a server script where the humanoid takes damage

how can i make a bullet effect with beam that causes less lag or do i need to change my ways?

Local script:

local Players = game:GetService("Players")

local Workspace = game:GetService("Workspace")
local replicatedstorage = game:GetService("ReplicatedStorage")

local LocalPlayer = Players.LocalPlayer
local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local mouse = LocalPlayer:GetMouse()

local function createRaycast()
	local origin = mouse.UnitRay.Origin
	local direction = mouse.UnitRay.Direction * 1000 -- Ray length of 1000 studs

	local raycastParams = RaycastParams.new()
	raycastParams.FilterDescendantsInstances = {character}
	raycastParams.FilterType = Enum.RaycastFilterType.Blacklist

	local raycastResult = Workspace:Raycast(origin, direction, raycastParams)

	if raycastResult then
		

		local characterModel = raycastResult.Instance:FindFirstAncestorOfClass("Model")
		if characterModel then
			local humanoid = characterModel:FindFirstChild("Humanoid")
			if humanoid then
				replicatedstorage.HIT:FireServer(humanoid)
			end
		end
	else
	end
end

script.Parent.Activated:Connect(function()
	createRaycast()
end)


Script:

game.ReplicatedStorage.HIT.OnServerEvent:Connect(function(plr, hum)
	if hum then
		hum:TakeDamage(30)
	end
end)