What i'm trying to do is edit a variable so when a child is added/removed it will connect a function..
wait(3)
player = game.Players.LocalPlayer
function Party()
this = nil
this = game.Lighting.Party:FindFirstChild(player.InParty.Value)
end
function update()
Party()
print(this)
local Slots = script.Parent:GetChildren()
local ok = this:GetChildren()
wait(1)
for i = 1, #Slots do
for a = 1, #ok do
if i == a then
Slots[i].Text = ok[a].Name
end
end
end
end
function deupdate()
local retext = script.Parent:GetChildren()
for i = 1, #retext do
if retext[i]:IsA("TextLabel") then
retext[i].Text = ""
end
end
update()
end
update()
Party()
this.ChildAdded:connect(deupdate)
this.ChildRemoved:connect(deupdate)
in function Party it's meant to update the variable "this" It only works with the original variable. Do I also need to update the connects at the bottom of the script?

1 comment
That doesn't work. It just keeps adding to the pile. and if a child gets added/removed it will fire multiple times so that doesn't work. :/