Laser Not Moving Fast Enough

I have tried to design a laser pointer for a gun. My problem is, the part that is the laser does not update fast enough to stay in line with the gun:


This is my script:

while true do
local lazer = Ray.new(script.Parent.Position, (script.Parent.Parent.PointerThroughPoint.Position - script.Parent.Position)*300)
	distance = (script.Parent.Position - script.Parent.Parent.PointerThroughPoint.Position).Magnitude
	local hitpart = workspace:FindPartOnRay(lazer)
	local distance2 = distance + 300
p = Instance.new("Part",workspace)
p.Name = "Dart"
p.Anchored = true
p.CanCollide = false
p.Material = "Neon"
p.BrickColor = BrickColor.new("Bright red")
p.Size = Vector3.new(0.1, 0.1, distance2)
	p.CFrame = CFrame.lookAt(script.Parent.Position, script.Parent.Parent.PointerThroughPoint.Position)*CFrame.new(0, 0, -distance2/2)
    wait()
	p:Destroy()
end

This is probably due to it being on the server, if you make the visual effect on the client it should put up with it better.

It’s still not moving fast enough

As nat said, you can use Client-Side to make the effects, I’d recommend you to use RunService.RenderStepped

Ohhhhh I get it now it works! Thank y’all so much!