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 4 years ago
Edited by SerpentineKing 4 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:

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.

0
PLEASE HELP ME jaymy12344567 -4 — 4y
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 — 4y
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 — 4y

2 answers

Log in to vote
2
Answered by 4 years ago

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.

Ad
Log in to vote
0
Answered by 4 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:

-- 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!

Answer this question