I'm using a script for creating and loading characters, but whenever I click Load, I get this error:
Players.Player.PlayerGui.ScreenGui.Frame.LocalScript:24: bad argument #3 to 'Text' (string expected, got table)
wait(0.43) local module = require(game:GetService('ServerScriptService'):WaitForChild('ModuleScript')) local characters = {} table.insert(characters,module.getChars(game.Players.LocalPlayer.UserId)) local pos = 0.15 script.Parent:WaitForChild('Create').MouseButton1Click:connect(function() script.Parent:WaitForChild('Create').Visible = false script.Parent:WaitForChild('Load').Visible = false script.Parent:WaitForChild('CC').Visible = true script.Parent:WaitForChild('Name').Visible = true end) script.Parent:WaitForChild('CC').MouseButton1Click:connect(function() module.createCharacter(script.Parent:WaitForChild('Name').Text,game.Players.LocalPlayer.UserId) end) script.Parent:WaitForChild('Load').MouseButton1Click:connect(function() script.Parent:WaitForChild('Load').Visible = false script.Parent:WaitForChild('Create').Visible = false for _, v in pairs(characters) do local a = script.Parent:WaitForChild('Template') a.Text = v a.Name = v a.Position = UDim2.new(0.035, 0,pos, 0) a.Visible = true pos = pos + 0.10 end end)
EDIT: This is what getChars basically does
local t = {} table.insert(t,ds3:GetAsync(player ..'_chars')) return t
Here's what I was talking about:
wait(0.43) local module = require(game:GetService('ServerScriptService'):WaitForChild('ModuleScript')) local characters = {} table.insert(characters,module.getChars(game.Players.LocalPlayer.UserId)) local pos = 0.15 script.Parent:WaitForChild('Create').MouseButton1Click:connect(function() script.Parent:WaitForChild('Create').Visible = false script.Parent:WaitForChild('Load').Visible = false script.Parent:WaitForChild('CC').Visible = true script.Parent:WaitForChild('Name').Visible = true end) script.Parent:WaitForChild('CC').MouseButton1Click:connect(function() module.createCharacter(script.Parent:WaitForChild('Name').Text,game.Players.LocalPlayer.UserId) end) script.Parent:WaitForChild('Load').MouseButton1Click:connect(function() script.Parent:WaitForChild('Load').Visible = false script.Parent:WaitForChild('Create').Visible = false for _, v in pairs(characters) do for i, k in pairs(v) do -- This will go through the table(s) inside of the 'characters' table local a = script.Parent:WaitForChild('Template') a.Text = k a.Name = k a.Position = UDim2.new(0.035, 0,pos, 0) a.Visible = true pos = pos + 0.10 end end end)