Today has been very productive with several concerns I have come upon and they have been addressed very methodically, I love it! So, to keep it going:
Hey Developers!
After figuring out How To Substitute Text For Variables I saw that I had another issue I figured I could fix with the event AncestryChanged
.
How far does AncestryChanged
go (To me, it looks like it only goes to a nested child’s immediate parent)? My issue lies within one script (two really) ObjectCloning
and the fact that it changes names of certain objects (intended). I want to write an event that will go to the point of conflict and change the name to a related term to avoid erroring.
Here are the deeds:
Function inside ObjectCloning
:
function ObjectCloning.CreateAssignedZoneClone()
local AssignedZoneClone = UnassignedZone:Clone()
AssignedZoneClone.Name = ZonePrefix … “_”… tostring(“Left”) … “”… ZoneSuffix
AssignedZoneClone.Parent = game.Workspace.VideoDetectionObjects.VideoZones
end
Output of ObjectCloning.CreateAssignedZoneClone()
: Vz_Left
I want the dubbed function PathCheck()
to run an event that can correct the referenced paths of the selection box Vz34
:
local AssignedZone = game.Workspace.VideoDetectionObjects.VideoZones.Vz34[...]
local ZoneName = game.Workspace.VideoDetectionObjects.VideoZones.Vz34[...]
local ZonePrefix = game.Workspace.VideoDetectionObjects.VideoZones.Vz34[...]
local ZoneIDNumber = game.Workspace.VideoDetectionObjects.VideoZones.Vz34[...]
local ZoneSuffix = game.Workspace.VideoDetectionObjects.VideoZones.Vz34[...]
My thoughts: A for loop to iterate through the hierarchy in order change the problematic syntax?
Something like ROBLOX’s example on the Developer Wiki (Descendants):
function descendants(obj, depth)
assert(obj and obj.GetChildren, "object parameter is missing or is not an instance")
local function yieldtree(obj, level)
if depth and level > depth then
return
end
for _, o in ipairs(obj:GetChildren()) do
coroutine.yield(o, level)
yieldtree(o, level+1)
end
end
return coroutine.wrap(function() yieldtree(obj, 1) end)