The script is supposed to clone a specific GUI based on the character's team. It is a local script, and located in Replicated First. (ServerStorage is a Folder in Replicated Storage incase anyone was wondering).
local player = game.Players.LocalPlayer player.CharacterAdded:connect(function(character) local scripts = character:WaitForChild("Scripts") for i, localscript in pairs(scripts:GetChildren()) do if localscript:IsA("LocalScript") then if not localscript.Disabled then localscript.Disabled = true localscript.Disabled = false end end end for i, gui in pairs(game.ReplicatedStorage.ServerStorage:GetChildren()) do if player.TeamColor == game.Teams["Axis Forces"].TeamColor then --[[ This is more reliable, change the 'Bright red Team' to your team's name. ]] if player.PlayerGui then gui:Clone().Parent = player.PlayerGui end end
Output reads: ReplicatedFirst.LocalScript:25: 'end' expected (to close 'for' at line 17) near '<eof>'
You're missing two ends to end your for loop and function.
The code should look like this,
local player = game.Players.LocalPlayer player.CharacterAdded:connect(function(character) local scripts = character:WaitForChild("Scripts") for i, localscript in pairs(scripts:GetChildren()) do if localscript:IsA("LocalScript") then if not localscript.Disabled then localscript.Disabled = true localscript.Disabled = false end end end for i, gui in pairs(game.ReplicatedStorage.ServerStorage:GetChildren()) do if player.TeamColor == game.Teams["Axis Forces"].TeamColor then --[[ This is more reliable, change the 'Bright red Team' to your team's name. ]] if player.PlayerGui then gui:Clone().Parent = player.PlayerGui end end end---two more ends end)
That should stop the errors.
There is just a small optimization issue that's annoying me. You used a player added function where one is not needed. The script will not run until it gets Replicated
To the player. Meaning we can safely run the code knowing it will only run for that local player from the beginning of the script. Here's what the optimized script will look like,
local player = game.Players.LocalPlayer local scripts = player:WaitForChild("Scripts") for i, localscript in pairs(scripts:GetChildren()) do if localscript:IsA("LocalScript") then if not localscript.Disabled then localscript.Disabled = true localscript.Disabled = false end end end for i, gui in pairs(game.ReplicatedStorage.ServerStorage:GetChildren()) do if player.TeamColor == game.Teams["Axis Forces"].TeamColor then --[[ This is more reliable, change the 'Bright red Team' to your team's name. ]] if player.PlayerGui then gui:Clone().Parent = player.PlayerGui end end end
Good luck!
Put an end like this: end) at the end of the whole script.