So, I'm trying to make a script that whenever somebody clicks two buttons they can insert a name to create another. I had no trouble with the script until randomly one line stopped working. I didn't change anything from the script, and all the line does is check if v is a frame. I have no idea what's causing this. Here's the script (Btw its a local script):
local filterd = game.ReplicatedStorage.Filter local fil = game.ReplicatedStorage.FilterBack local check = game.ReplicatedStorage.Send2 local server = game.ReplicatedStorage.ServerCreate local counter = 0 local precheck = false local id local id2 local check = game.StarterGui.Main.Scroll:GetChildren() local fail = game.ReplicatedStorage.Fail local success = game.ReplicatedStorage.Success local player = game.Players.LocalPlayer local newgui = player:WaitForChild("PlayerGui"):WaitForChild("Request").TextBox local debounce = false check.OnClientEvent:Connect(function(button) counter = counter + 1 if counter == 1 then id = button.Parent.ID.Value else id2 = button.Parent.ID.Value counter = 0 for i, v in pairs(game.StarterGui.Main.Scroll:GetChildren()) do if v:IsA("Frame") then --this isnt the problem line, its farther down if v.ID.Value == id + id2 then if player.PlayerGui.Main.Scroll:FindFirstChild(v.Name) then v:Destroy() end debounce = true local guiclone = v:Clone() guiclone.Parent = player.PlayerGui.Main.Scroll success:Play() end end if not debounce then debounce = true if v:IsA("Frame") then --problem line if v.ID.Value ~= id + id2 then if #game.StarterGui.Main.Scroll:GetChildren() - 1 <= #player.PlayerGui.Main.Scroll:GetChildren() - 1 then fail:Play() newgui.Visible = true newgui.Parent.TextButton.Visible = true newgui.Parent.TextButton.MouseButton1Click:Connect(function() filterd:FireServer(newgui.Text) fil.OnClientEvent:Connect(function(filtered) newgui:ReleaseFocus() local createserverelement = server:InvokeServer(filtered, id, id2) if createserverelement == true then newgui.Text = "" newgui.Visible = false newgui.Parent.TextButton.Visible = false success:Play() wait() debounce = false else if player.PlayerGui.Main.Scroll:FindFirstChild((tostring(filtered))) then newgui.Visible = false newgui.Parent.TextButton.Visible = false fail:Play() end end end) end) end end end end end end end)
So if you could help, I would appreciate it!
Turns out that line wasn't actually the culprit. It was the other Isa. I had to change that if from an end directly there to an else.