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

Why does this Script Duplicate Buttons?

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

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

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