local distance = (position - tool.Muzzle.CFrame.p).magnitude
local rayPart = Instance.new("Part", tool)
rayPart.Name = "RayPart"
rayPart.BrickColor = BrickColor.new(194)
rayPart.Transparency = 0
rayPart.Anchored = true
rayPart.CanCollide = false
rayPart.TopSurface = Enum.SurfaceType.Smooth
rayPart.BottomSurface = Enum.SurfaceType.Smooth
rayPart.formFactor = Enum.FormFactor.Custom
rayPart.Size = Vector3.new(2, 5, 2)
rayPart.CFrame = CFrame.new(position, tool.Muzzle.CFrame.p) * CFrame.new(0, 0, 1) * convertToCFrameDegrees(90, 0, 0)
local rayMesh = Instance.new("CylinderMesh",rayPart)
rayMesh.Scale = Vector3.new(1,1,1)
rayMesh.Offset = Vector3.new(0, -distance + rayMesh.Scale.y/2, 0)
-- rayMesh.Scale = Vector3.new(1,distance,1)
-- rayMesh.Offset = Vector3.new(0, -distance/2, 0)
✓ ANSWER ACCEPTED
How to add fire to this?
2 answers
✓ Accepted answer
We could use the Instance.new function to create the said object inside of rayPart.
Instance.new('Fire',rayPart);
This should create the Fire class inside the second argument of Instance.new, which is it's parent.
Hope this helped.
raypart.Instance.new("Fire")
put this at the end of ur script and i think it should work
2 comments
0
well, really u could put it anywhere
0
also could u accept the answer if it works? thanks!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Just add [local Fire = Instance.new("Fire",rayPart)]. :P
With or without the brackets?