Whats the best way to make a spinning laser without lag?

Iam currently using body angular force but it creates a lot of ping!

Here’s what I do in my games:

  • Make two transparent, and small parts on the client-side.
  • Create a beam instance, and set part0 and part1 to the small client-side parts that you just created.
  • Put part0 on the laser tip (try using motor6d and changing its c0 to match the laser tip).
  • Constantly push part1 to the aim point.
  • Set AlwaysFaceCamera in the beam to true.
  • Make the beam super thin, and change it’s color to the laser color.

That is how I do it, it will be visible only to the person with the laser, but you could implement this however you like so that others can also see it (I wouldn’t recommend making it global). This will ensure that there is no server interaction here.

1 Like

What is a “spinning laser” in this context?

Is it just a spinning part? If so, I would just anchor it and do something like this in a server script:

local rotPerSecond = 2
local partToRotate = game.Workspace.Laser

local currentAngle = 0
local position = partToRotate.Position

local function Update(t, dt)
    currentAngle = currentAngle + 2*math.pi*dt
    partToRotate = CFrame.Angles(0, currentAngle, 0) + position
end

game:GetService("RunService").Stepped:Connect(Update)

If you have a bunch of them, use CollectionService.