I want these functions to work, but only when data has been set. "data" is an object value. The problem is that "data" starts of as nil and these cause my script to break, how can I fix that?
data.Value.Items.ChildAdded:connect(update) data.Value.Items:WaitForChild(script.Parent.Name).Changed:connect(update)
I figured it out, I can just disconnect the old connect before reinstating it. Go me! :)
if a~= nil then a:disconnect() end if b~=nil then b:disconnect() end if data.Value~=nil then a = data.Value.Items.ChildAdded:connect(update) b = data.Value.Items:WaitForChild(script.Parent.Name).Changed:connect(update) end