I’m making a plugin and the current issue as stated in the title is that Instead of my function searching for that value with that specific name it’s actually duplicating it every time I run the function.
local function goto()
local duration = tonumber(PageInsert.Text)
if duration and duration <=amountofD.Value then
number.Text = PageInsert.Text
number.Text = "P"..number.Text
for _, v in pairs(CHDIALOG:GetDescendants()) do
if v.Name == number.Text then
insertDialog.Text = v.Value
--[[number.Visible = true
Finish.Visible = true
insertDialog.Visible = true
CloneTemplate.Visible = true--]]
else
local ValueFor = Instance.new("StringValue")
ValueFor.Name = number.Text
ValueFor.Value = insertDialog.Text
ValueFor.Parent = CHDIALOG
--[[number.Visible = true
Finish.Visible = true
insertDialog.Visible = true
CloneTemplate.Visible = true--]]
end
end
end
end
gotopage.MouseButton1Click:Connect(goto)
Result after copying the output into startergui:
https://gyazo.com/54ba45478e929100d0fe3a64f90a371b