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

Why does this Script Duplicate Buttons?

Asked by
Rackm 10
10 years ago

I have two types of these scripts. 1 that Parents to PlayerGui and 1 that Parents to StarterGui. The 2 scripts are in the Same Parent/Frame

game.Lighting.Reports.ChildAdded:connect(function (child)
    wait(3)
    local reports = game.Lighting.Reports
    local player = child.Player.Value

    local newbutton = Instance.new("TextButton")
    local prev = game.StarterGui.ReportGUI.CheckReports.PrevButton
    local button = game.StarterGui.ReportGUI.CheckReports["TextButton"..prev.Value]

    if child then
        newbutton.BackgroundColor3 = Color3.new(100/255, 100/255, 100/255)
        newbutton.BackgroundTransparency = 0.3 
        newbutton.Position = button.Position + UDim2.new(0,0,0,30)
        newbutton.Name = "TextButton"..prev.Value + 1
        newbutton.Size = UDim2.new(0, 430, 0, 23)
        newbutton.Font = "SourceSansBold"
        newbutton.FontSize = Enum.FontSize.Size18
        newbutton.Text = player
        newbutton.TextColor3 = Color3.new(0, 0, 0)
        newbutton.Parent = game.StarterGui.ReportGUI.CheckReports

        local lightingscript = game.Lighting.ScriptsForReport

        lightingscript.ButtonPress:Clone().Parent = game.StarterGui.ReportGUI.CheckReports["TextButton"..prev.Value + 1]

        prev.Value = prev.Value + 1
    end
end)

1 answer

Log in to vote
0
Answered by
ZeroBits 142
10 years ago

if you have two of the script it would create two buttons.

Ad

Answer this question