Forgive me for posting this - But I’m trying to figure out how to create a “Projectile” using a mesh’s offset that travels from one side of the Ray’s beam to another. I’m fairly certain I’ve seen a post about this in the past but I can’t seem to locate it.
This is the code I’m attempting to edit - It’s the simple ROBLOX Raycast Demo. None of my attempts seem to work.
local ray = Ray.new(System.Exterior.Root.CFrame.p, (TargetPos - System.Exterior.Root.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, System.Exterior, false, true)
local beam = Instance.new("Part", workspace)
beam.BrickColor = BrickColor.new("Bright red")
beam.FormFactor = "Custom"
beam.Material = "Neon"
beam.Transparency = 0.25
beam.Anchored = true
beam.Locked = true
beam.CanCollide = false
local distance = (System.Exterior.Root.CFrame.p - position).magnitude
beam.Size = Vector3.new(0.3, 0.3, distance)
beam.CFrame = CFrame.new(System.Exterior.Root.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
game:GetService("Debris"):AddItem(beam, 0.1)