Hi, I found a yt vid for a draw distance script. Here is the script:
However I am unsure if it would be bad for performance as I would have over 1000 different objects in this “Draw distance folder”
The script:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")
local RunSerivce = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local RenderCache = ReplicatedStorage:WaitForChild("RenderCache")
local Character = script.Parent
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local RenderDistance = 900
local Render = Workspace:WaitForChild("Draw_Distance")
local Parts = {}
function Scan()
for _, Object in next, Render:GetChildren() do
table.insert(Parts, Object)
Object.Parent = RenderCache
end
end
function GetPart (Object)
if (Object:IsA("BasePart")) then
return Object
else
for _, Obj in next, Object:GetChildren() do
return GetPart(Obj)
end
end
return nil
end
function Update()
for _, v in next, Parts do
local Part = GetPart(v)
if (Part) then
local Distance = (Part.CFrame.p - HumanoidRootPart.CFrame.p).Magnitude
Distance = math.floor(Distance + 0.5)
if (Distance <= RenderDistance) then
v.Parent = Render
else
v.Parent = RenderCache
end
end
end
end
Scan()
RunSerivce:BindToRenderStep("RenderSys", 1, Update)
Let me know if I can do anything to make it better for performance or if it isn’t bad for performance.
Cheers,