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

script not detecting when child is added into workspace folder?

Asked by 2 years ago
Edited 2 years ago
game.Workspace.Tycoons.ChildAdded:Connect(function(Tycoon)
    print(Tycoon)
end)

This script which is located in workspace does not detect when a child / model is added into a certain folder in Workspace. but it does detect any child added INTO workspace, not a folder. What is the issue here?

FULL CODE:

local num = 0

game.Workspace.Tycoons.ChildAdded:Connect(function(Tycoon)
    local startbutton = script.Parent[num]

    local Name = Tycoon.Owner.Value
    local Button = startbutton:Clone()

    num += 1

    Button.Parent = script.Parent
    Button.OwnerV.Value = Tycoon.Owner.Value
    Button.Owner.Text = Tycoon.Owner.Value
    Button.Name = num

    Button.Position = startbutton.Positon + UDim2.new(0,0,100,0)
    Button.BackgroundTransparency = 0
    Button.Owner.TextTransparency = 0
end)
0
If you're wondering, the child that is being added into the folder is named from players joining. Etc, john2512, and its a model with other parts inside of it. I'm only trying to detect if A CHILD is added into the folder though. GuestHacks666 20 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

You need quotation marks around Tycoon on line 2. This happens because you defined tycoon in line one so when you reference it in line 2 it thinks you are trying to print what you defined.

0
print(Tycoon.Name) doesnt work either? GuestHacks666 20 — 2y
0
I would need more of the code to see what you are trying to do Noahbb22 2 — 2y
0
local num = 0 game.Workspace.Tycoons.ChildAdded:Connect(function(Tycoon) local startbutton = script.Parent[num] local Name = Tycoon.Owner.Value local Button = startbutton:Clone() num += 1 Button.Parent = script.Parent Button.OwnerV.Value = Tycoon.Owner.Value Button.Owner.Text = Tycoon.Owner.Value Button.Name = num Button.Position = startbutton.Positon + UDim2.new(0,0,100,0) Button.B GuestHacks666 20 — 2y
0
I posted the full code on the comment GuestHacks666 20 — 2y
0
I don't think he's trying to print a string. PaleNoobs 37 — 2y
Ad

Answer this question