Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

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

Asked by 5 years ago
Edited by SerpentineKing 5 years ago

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:

01local player=game.Players.LocalPlayer
02local character
03 
04--Character Loading
05player.CharacterAdded:connect(function(c)
06    character=c
07end)
08 
09--Gui Variables
10local gui=player:WaitForChild("PlayerGui")
11local ui=gui:WaitForChild("ui")
12 
13--Load Assets
14local assetObject=script:WaitForChild("Assets")
15local assets{}
View all 23 lines...

The { is underlined.

0
PLEASE HELP ME jaymy12344567 -4 — 5y
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. Ashton011 30 — 5y
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 123nabilben123 499 — 5y

2 answers

Log in to vote
2
Answered by 5 years ago

It just a basic syntax error:

01local player=game.Players.LocalPlayer
02local character
03player.CharacterAdded:connect(function(c) character=c end)
04 
05local gui=player:WaitForChild("PlayerGui")
06 
07local ui=gui:WaitForChild("ui")
08 
09local assetObject=script:WaitForChild("Assets")
10local assets = {} --You forgot =
11for a.b in next.assetObject:GetChildren() do
12    assets[b.Name]=b
13end
14 
15function teamchoose()
16    local chooseUI=assets.teamChoose:Clone()
17end

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

Ad
Log in to vote
0
Answered by 5 years ago

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:

1-- You do not need to create your assets table up here
2 
3for 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.
4    b.Name = b -- B already equals b.Name so I don't understand why you need to run this
5end
  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!

Answer this question