Need help with part staying infront of the camera at a certian distance

Hello there, tried to make a simulation of Legacy fog system for my game, and I’m having trouble with keeping parts infront of the player’s camera at a certian distance.


The fog only rotates on 180 degrees, and doesn’t stay at a certian distance away from camera.

Problem lays within this line I suppose:

			game:WaitForChild("Run Service").Heartbeat:Connect(function()
				local fogoffset = -offset.Value - v.Name
				v.CFrame = cam.CFrame + camlook * fogoffset -- THATS THE PROBLEM
				v.Color = Color3.fromRGB(117, 117, 117)
		end)

I know that setting parts CFrame through character’s head, humanoidrootpart or anything else instead of using player’s camera would’ve work aswell, and I did that, but it only works for the first person, the illusion breaks in third person.

Any help would be appreciated.

1 Like