Hey! I’m currently building a pretty big map for a game and was looking for some ways to reduce lag. I know streaming enabled is an option but it’s not really what im looking for (or im just doing it wrong).
Does anybody know how to remove parts from the workspace and send them to replicated storage if the player is too far away from the selected parts? I have everything in folders so i would just need to know how to remove folders from the work space and send them to replicated storage. Thanks!
One thing is, you need to use Localscripts, or Server scripts with remotes leading to localscripts.
Then you would need magnitude to detect the range of parts.
Maybe something like:
local Map = workspace.Folder_Name_Here
local range = 50
local storage = Game.ReplicatedStorage.Folder_Name_Here
while task.wait(2) do
for i, v in pairs(Map:GetChildren()) do
if v:IsA(“BasePart”) then
local magnitude = (HRP.Position-v.Position).Magnitude
if magnitude > range then
v.Parent = storage
else
v.Parent = Map
end
end
end
end