Block-based FOV system

Hello there, I have designed an FOV system for the upcoming game that I’m working on called “Hallway of Time”; An RGD fan-game designed to be harder than the original.


FOVLength = 20 -- Doesn't exactly mean the amount of studs in length
FOV_X = 7.5 -- FOV's X scale
FOV_Y = 2.5 -- FOV's Y scale

local Blocks = {}

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")

local TemporaryInstances ="Folder", ReplicatedFirst) -- Just in case
TemporaryInstances.Name = "TemporaryInstances"

local Head = script.Parent.Head

-- Main Component --
local function CreateBlocks(X, Y, FOVLength)
	local NPCFOVFolder ="Folder", TemporaryInstances)
	NPCFOVFolder.Name = Head.Parent.Name

	for Distance = 0, FOVLength, 1 do
		local Field = Distance / FOVLength

		local Block ="Part", NPCFOVFolder)

		Block.Anchored = true
		Block.CanCollide = false

		Block.Size = + (FOV_X * Field), 1 + (FOV_Y * Field), 1 + Field)

			while true do
				Block.CFrame = Head.CFrame *,0,-(Field * FOVLength)-Field)

		table.insert(Blocks, Block)

CreateBlocks(FOV_X * (FOVLength / 2), FOV_Y * (FOVLength / 2), FOVLength)

What bothers me is how slow it’s moving, then again it’s being delayed to make sure there are no memory leaks or at least lags.


First, create a folder named “TemporaryInstances” inside ReplicatedFirst.
Then, create a folder inside TemporaryInstances named after the humanoid stored inside.
Now, create several blocks, layer them in a way that looks like a camera FOV and then store them both inside Blocks and inside the folder named after the humanoid.

Yes, I’m tired so this may not be the best explanation I’ve ever given.

1 Like