This is some code for a minimap. Every time i use it though it loads a section but everything else doesn’t load. Is there any way to make this keep rendering every few seconds?
Update: I did some tests and i think it has to do with whats on the map, and whats not on the map. How can i make it now so that it gets all the children of the folder and not not just the direct ones
If your game uses Instance Streaming (the StreamingEnabled property underneath Workspace enables that), the “only one section of the map present, everything else missing” problem is probably because of that. Roblox will stream in 3D objects near your character, and objects outside that range are not gonna be present.
local PresentObjects = {}
for _, Object in pairs(MapObjects:GetChildren()) do
local ClonedObject = Object:Clone()
ClonedObject.Parent = Minimap
PresentObjects[Object] = ClonedObject
end
Minimap.ChildAdded:Connect(function(Object)
local ClonedObject = Object:Clone()
ClonedObject.Parent = Minimap
PresentObjects[Object] = ClonedObject
end)
Minimap.ChildRemoved:Connect(function(Object)
local ClonedObject = PresentObjects[Object]
if ClonedObject then
ClonedObject:Destroy()
end
end)
The PresentObjects table is required to keep track of which objects have been cloned, and a reference to the object clone itself to destroy it when the object in workspace streams out.