I've been searching for an answer for a good bit now, and have gained no knowledge to this topic.

I need to add a spread to a ray cast gun that can be modified to be more extreme/more inaccurate or it can be more accurate.

I am very new to many CFrame functions & what not so hoping some people here know their stuff more than I do.

Here's some code from where I think it would be needed:

Snippet #1 where the ray is created

local ray = Ray.new(tool.ShootPart.CFrame.p, (mouse.Hit.p - tool.ShootPart.CFrame.p).unit * maxRange.Value) --//We create our ray.

Snippet #2 where the beam is made

local beam = Instance.new("Part", workspace) --//Create the new beam

These both are in a LocalScript, and I'm using a server script to fireallclients to reduce lag.