Instance:IsA randomly stopped working? [FIXED]
Asked by
4 years ago Edited 4 years ago
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):
01 | local filterd = game.ReplicatedStorage.Filter |
02 | local fil = game.ReplicatedStorage.FilterBack |
03 | local check = game.ReplicatedStorage.Send 2 |
04 | local server = game.ReplicatedStorage.ServerCreate |
09 | local check = game.StarterGui.Main.Scroll:GetChildren() |
10 | local fail = game.ReplicatedStorage.Fail |
11 | local success = game.ReplicatedStorage.Success |
12 | local player = game.Players.LocalPlayer |
13 | local newgui = player:WaitForChild( "PlayerGui" ):WaitForChild( "Request" ).TextBox |
15 | check.OnClientEvent:Connect( function (button) |
18 | id = button.Parent.ID.Value |
20 | id 2 = button.Parent.ID.Value |
22 | for i, v in pairs (game.StarterGui.Main.Scroll:GetChildren()) do |
23 | if v:IsA( "Frame" ) then |
24 | if v.ID.Value = = id + id 2 then |
25 | if player.PlayerGui.Main.Scroll:FindFirstChild(v.Name) then |
29 | local guiclone = v:Clone() |
30 | guiclone.Parent = player.PlayerGui.Main.Scroll |
37 | if v:IsA( "Frame" ) then |
38 | if v.ID.Value ~ = id + id 2 then |
39 | if #game.StarterGui.Main.Scroll:GetChildren() - 1 < = #player.PlayerGui.Main.Scroll:GetChildren() - 1 then |
42 | newgui.Parent.TextButton.Visible = true |
44 | newgui.Parent.TextButton.MouseButton 1 Click:Connect( function () |
45 | filterd:FireServer(newgui.Text) |
46 | fil.OnClientEvent:Connect( function (filtered) |
48 | local createserverelement = server:InvokeServer(filtered, id, id 2 ) |
49 | if createserverelement = = true then |
52 | newgui.Visible = false |
53 | newgui.Parent.TextButton.Visible = false |
58 | if player.PlayerGui.Main.Scroll:FindFirstChild(( tostring (filtered))) then |
59 | newgui.Visible = false |
60 | newgui.Parent.TextButton.Visible = false |
So if you could help, I would appreciate it!