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:
01 | local player = game.Players.LocalPlayer |
02 | local character |
03 |
04 | --Character Loading |
05 | player.CharacterAdded:connect( function (c) |
06 | character = c |
07 | end ) |
08 |
09 | --Gui Variables |
10 | local gui = player:WaitForChild( "PlayerGui" ) |
11 | local ui = gui:WaitForChild( "ui" ) |
12 |
13 | --Load Assets |
14 | local assetObject = script:WaitForChild( "Assets" ) |
15 | local assets { } |
The { is underlined.
It just a basic syntax error:
01 | local player = game.Players.LocalPlayer |
02 | local character |
03 | player.CharacterAdded:connect( function (c) character = c end ) |
04 |
05 | local gui = player:WaitForChild( "PlayerGui" ) |
06 |
07 | local ui = gui:WaitForChild( "ui" ) |
08 |
09 | local assetObject = script:WaitForChild( "Assets" ) |
10 | local assets = { } --You forgot = |
11 | for a.b in next .assetObject:GetChildren() do |
12 | assets [ b.Name ] = b |
13 | end |
14 |
15 | function teamchoose() |
16 | local chooseUI = assets.teamChoose:Clone() |
17 | 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.
You don't need a table if you are going to use assetObject:GetChildren(). Whatever you put after next
, that is your table.
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 |
3 | 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. |
4 | b.Name = b -- B already equals b.Name so I don't understand why you need to run this |
5 | end |
Hope this helps!