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.
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.
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:
-- 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
Hope this helps!