I was able to create a bullet trail on my client, but I want other players to be able to see it. To do this I am creating the part on the server, as you see below.
local function trace()
-- Create
local trace = Instance.new("Part")
trace.Anchored = true
trace.CanCollide = false
trace.Transparency = 0.5
trace.BrickColor = BrickColor.new("White")
trace.Material = Enum.Material.SmoothPlastic
-- Calculate
local distance = (hole.CFrame.p - position).magnitude
trace.Size = Vector3.new(0, 0, distance)
trace.CFrame = CFrame.new(hole.CFrame.p, position) *CFrame.new (0, 0, -distance/2)
trace.Parent = workspace
-- Clean-up
game:GetService("Debris"):AddItem(trace, 0.1)
However, I am not sure how I can get the position on the ray from the localscript below to the server so I can use it for creation of the bullet trail.
-- Cast Ray
local ray = Ray.new(hole.CFrame.p, (mouse.hit.p - hole.CFrame.p).unit * range.Value)
local touch, position = workspace:FindPartOnRay(ray, player.Character, false, true)

1 comment
Thank you so much!