I've been getting an error in testing on my game that says that "tables cannot be cyclic". The code is shown below. Is there a reason for why this is happening? Thanks!
LOCALSCRIPT1:
plr.PlayerGui.Attacks.Frame.LocalScript.Spawn:Invoke(atks)
LOCALSCRIPT2:
local at1 = script.Parent:FindFirstChild("Attack1") local a1 = nil local at2 = script.Parent:FindFirstChild("Attack2") local a2 = nil local at3 = script.Parent:FindFirstChild("Attack3") local a3 = nil local at4 = script.Parent:FindFirstChild("Attack4") local a4 = nil function change(m1,m2,m3,m4) local atks = game.ReplicatedStorage.Attacks.AddAttacks:InvokeServer(m1,m2,m3,m4) for n,v in pairs(atks) do if not a1 then at1.Name = v[1] at1:FindFirstChild("Name").Text = v[1] at1:FindFirstChild("PP").Value = v[2] at1:FindFirstChild("Type1").Image = "rbxassetid://"..v[3][1] at1.ImageColor3 = Color3.new(v[3][2],v[3][3],v[3][4]) at1.Background.Visible = true at1.Bar.Visible = true a1 = n else if not a2 then at2.Name = v[1] at2:FindFirstChild("Name").Text = v[1] at2:FindFirstChild("PP").Value = v[2] at2:FindFirstChild("Type1").Image = "rbxassetid://"..v[3][1] at2.ImageColor3 = Color3.new(v[3][2],v[3][3],v[3][4]) at2.Background.Visible = true at2.Bar.Visible = true a2 = n else if not a3 then at3.Name = v[1] at3:FindFirstChild("Name").Text = v[1] at3:FindFirstChild("PP").Value = v[2] at3:FindFirstChild("Type1").Image = "rbxassetid://"..v[3][1] at3.ImageColor3 = Color3.new(v[3][2],v[3][3],v[3][4]) at3.Background.Visible = true at3.Bar.Visible = true a3 = n else if not a4 then at4.Name = v[1] at4:FindFirstChild("Name").Text = v[1] at4:FindFirstChild("PP").Value = v[2] at4:FindFirstChild("Type1").Image = "rbxassetid://"..v[3][1] at4.ImageColor3 = Color3.new(v[3][2],v[3][3],v[3][4]) at4.Background.Visible = true at4.Bar.Visible = true a4 = n end end end end end end function script.Spawn.OnInvoke(g) change(g[1],g[2],g[3],g[4]) end
SERVERSCRIPT:
function game.ReplicatedStorage.Attacks.AddAttacks.OnServerInvoke(plr,m1,m2,m3,m4) local moves = {} if attacks[m1] then moves[1] = {m1,attacks[m1][1],attacktypes[attacks[m1][2]]} end if attacks[m2] then moves[2] = {m2,attacks[m2][1],attacktypes[attacks[m2][2]]} end if attacks[m3] then moves[3] = {m3,attacks[m3][1],attacktypes[attacks[m3][2]]} end if attacks[m4] then moves[4] = {m4,attacks[m4][1],attacktypes[attacks[m4][2]]} end return moves end