Is there a way to create a "Reverse Local Transparency" part?

Good evening.

I’m currently working on the script of a tool using raycasting.

Long story short: I want to make a brick (that is raycasted) invisible to the client that activated it and only visible to everyone else in the server, AKA Server sided.

So I’m asking if there is a way to do so, the script handling this is currently in a regular script(to be visible to the server in the first place).

In case it is needed, the script that handles said raycast that I wish to be so is this:

local UserInputService = game:GetService("UserInputService")
local FireRate = script.Parent.FireRate.Value
tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local Ammo = script.Parent.ReserveAmmo.Value
local Magazine = tool.Magazine.Value
local CanShoot = true
FireRateCooldown = true
Fire = script.Parent.Fire

script.Parent.Fire.OnServerEvent:connect(function(player, mouse, part)

	local ray = Ray.new(tool.Barrel.Position, (mouse - tool.Barrel.Position).unit * 300)
	local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)


	local beam = Instance.new("Part", workspace)
	beam.BrickColor = BrickColor.new("Institutional white")
	beam.FormFactor = "Custom"
	beam.Material = "Neon"
	beam.Transparency = 0.25
	beam.Anchored = true
	beam.Locked = true
	beam.CanCollide = false
	local distance = (tool.Handle.CFrame.p - position).magnitude
	beam.Size = Vector3.new(0.3, 0.3, distance)
	beam.CFrame = CFrame.new(tool.Barrel.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)

	game:GetService("Debris"):AddItem(beam, 0.1)

end)

Just a simple Raycasting script, nothing too advanced. Just trying to get a “proof of concept” for now.

Assuming you already have a LocalScript defined for this specific visual, you can try the following:
LocalTransparencyModifier

Problem is: The raycast needs to be done on the server, so it needs to be on a regular script.

I’ve fixed this issue on my own, I used secondary localscript to handle the server’s raycast using LocalTransparencyModifier.