Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

There's a red underline on my table, whats wrong with it, and how do I fix it?

I'm trying to make a Roblox game and, I'm listening to an old guide. Maybe that's why. Anyways, This is my script:

local player=game.Players.LocalPlayer
local character

--Character Loading
player.CharacterAdded:connect(function(c)
	character=c
end)

--Gui Variables
local gui=player:WaitForChild("PlayerGui")
local ui=gui:WaitForChild("ui")

--Load Assets
local assetObject=script:WaitForChild("Assets")
local assets{}
for a.b in next.assetObject:GetChildren() do
	assets[b.Name]=b
end

--Team Choose Function
function teamchoose()
	local chooseUI=assets.teamChoose:Clone()
end

The { is underlined.

3 comments

0

PLEASE HELP ME

0

can you code block it? When you edit/start a post, you press the button above the post thats all the way to the right that has the Lua symbol. Then you paste your code in between the two lines.

0

if it says an underline, then it has some kind of message to tell you whats going on. Hover your mouse over the underline and it will display a message telling you whats wrong

2 answers

It just a basic syntax error:

local player=game.Players.LocalPlayer 
local character
player.CharacterAdded:connect(function(c) character=c end)

local gui=player:WaitForChild("PlayerGui") 

local ui=gui:WaitForChild("ui")

local assetObject=script:WaitForChild("Assets") 
local assets = {} --You forgot =
for a.b in next.assetObject:GetChildren() do 
	assets[b.Name]=b 
end

function teamchoose() 
	local chooseUI=assets.teamChoose:Clone() 
end

And next time, please put your code in code block.

Please format your script in a code block next time, so we can better understand your code.

  1. You don't need a table if you are going to use assetObject:GetChildren(). Whatever you put after next, that is your table.

  2. You've got some problems in your for loop. I will just show you what it should look like:

-- You do not need to create your assets table up here

for a,b in next(assetObject:GetChildren()) do -- You should have a comma to separate a and b. assetObject:GetChildren() should be in parenthesis/brackets after next.
	b.Name = b -- B already equals b.Name so I don't understand why you need to run this
end
  1. When you clone your teamChoose, give the clone a parent because then the script will not know where to put the clone.

Hope this helps!

This discussion is preserved as it was. New answers, comments, and votes are closed.