I put a local script in StarterPlayer in StarterPlayerScripts, the local script is below. After that, i put a CFrameValue and renamed it Renderable inside parts but that does not work, i don't know anymore solutions. I am hoping one of you guys can see the problem in the script, and there are no errors shown.

local HumanoidRootPart
local Workspace = game.Workspace
local Player = game.Players.LocalPlayer

local RenderParts = {}

local MaxRenderRadius = 50
local MinRenderOutRadius = MaxRenderRadius * 1

for i,v in pairs(game.Workspace:GetChildren()) do
	if v:FindFirstChild("Renderable") then
		table.insert(RenderParts, v)
	end
end

local function CharacterAdded(Character)
	if Character then
		HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
	end
end

CharacterAdded(Player.Character)
Player.CharacterAdded:Connect(CharacterAdded)

local function SetPartVisible(PartName, Visible)
	if Visible == false then
		PartName.Parent = nil
	end
	if Visible == true then
		PartName.Parent = Workspace
	end
end

while true do
	wait(0.1)
	if HumanoidRootPart then
		for i=1, #RenderParts do
			
			if RenderParts[i].ClassName ~= "Model" then
				if (HumanoidRootPart.Position - RenderParts[i].Position).Magnitide >= MinRenderOutRadius then
					SetPartVisible(RenderParts[i], false)
				end
			end
			if RenderParts[i].ClassName == "Model" then
				if (HumanoidRootPart.Position - RenderParts[i]:GetPrimaryPartCFrame().p).Magnitide >= MinRenderOutRadius then
					SetPartVisible(RenderParts[i], false)
				end
			end
			if RenderParts[i].ClassName ~= "Model" then
				if (HumanoidRootPart.Position - RenderParts[i].Position).Magnitide <= MaxRenderRadius then
					SetPartVisible(RenderParts[i], true)
				end
			end
			if RenderParts[i].ClassName == "Model" then
				if (HumanoidRootPart.Position - RenderParts[i]:GetPrimaryPartCFrame().p).Magnitide >= MaxRenderRadius then
					SetPartVisible(RenderParts[i], true)
				end
			end
			
		end
	end
end