Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

ChildAdded() Event not Firing?

Asked by 9 years ago
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

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

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)
0
sorry, I went to sleep after posting. They're supposed to be .Name The event isn't firing. SamDomino 65 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

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)

Answer this question