PointLight lags when parented to a part that is moved every frame

Hello! I tried adding a feature that would have a source of light wherever the mouse is pointing. I used RunService.Stepped and Mouse.Hit for this function, which resulted in this:

-- this is not the exact code as I use TypeScript via roblox-ts
-- also, this is client-sided

function test()
    local mouse = Players.LocalPlayer:GetMouse()
    mouse.TargetFilter = part
    RunService.Stepped:Connect(function()
        local mousePos = mouse.Hit.Position
        part.Position = new Vector3(mouse.Pos.X, 1.2, mousePos.Z)
    end)
end

-- typescript code looks like this

	private test() {
		const mouse = Players.LocalPlayer.GetMouse()
		mouse.TargetFilter = this.part

		RunService.Heartbeat.Connect(() => {
			const mousePos = mouse.Hit.Position

			this.part.Position = new Vector3(mousePos.X, 1.2, mousePos.Z)
		})
	}

I initially thought that the issue concerned how I moved the object. So, I tried various means such as while true do wait(), TweenService, and others to no avail. However, I made the part visible and noticed the light lagging rather than the part. This is evident in the following video:

This brings me to my main point: is this a Roblox issue or my issue? I’m not that educated in this topic but I might have heard that rendering light is pretty heavy. But then again, my laptop is very old so this may have to do with my device rather than Roblox itself. If it is a Roblox issue, is there any workaround to this? I hope to get some insight on this!

1 Like

It’s a roblox issue, lighting just doesn’t update that fast.

You could try messing with the Lighting.Technology, but that affects your whole game.

You can try setting the network ownership of the part to the client or something, but I doubt that will change anything.

3 Likes