Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

ChildAdded() Event not Firing?

c.Lanes.LeftLane.ChildAdded:connect(function(R)
l=n.Name
s=Notes.Name
R.Name=tostring((l)..(s))
print(R)
Lane.Value=R:GetFullName()
end)

Variables

c=script.Parent.Game.Board -- GUI Object
n=(c.Note) -- NumberValue bool
Notes=c.Notes --NumberValue bool
Lane=c.Lane -- Gui Frame

I don't know why but for some reason the event doesn't fire when a child is added to

c.Lanes.LeftLane I get 0 errors when testing the scripting in Solo Mode.

2 answers

I think that you're meaning .Value, rather than .Name on lines 2 and 3

Tell me if i'm wrong.

c = script.Parent.Game.Board
n = (c.Note)
Notes = c.Notes
Lane = c.Lane

c.Lanes.LeftLane.ChildAdded:connect(function(R)
	l = n.Value
	s = Notes.Value
	R.Name=tostring((l)..(s))
	print(R)
	Lane.Value = R:GetFullName()
end)

1 comment

0

sorry, I went to sleep after posting. They're supposed to be .Name The event isn't firing.

It doesn't work because you tell it to print R, and not R's name. Here's the fixed script:

c.Lanes.LeftLane.ChildAdded:connect(function(R)
	l=n.Name
	s=Notes.Name
	R.Name=tostring((l)..(s))
	print(R.Name) --If it's just "R", then it tries to print userdata, and not a string (R's name)
	Lane.Value=R:GetFullName()
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.