Hi DevForum! I ran into an error when trying to use a localscript to require a module script so I am able to use it in a gui.
Basically, what I am trying to make/edit is a scoreboard, but this one part of it is not working. It is automatically supposed to detect the home team and instantly put the team’s name and colors on the home section of the scoreboard gui, but again, that part is not working. For some reason, it works in the other game I have it in, but this one isn’t working.
TeamInfo has information about teams and their colors, etc. Here is a short piece from teaminfo:
local function Color(R,G,B)
return Color3.new(R/255,G/255,B/255)
end
-- // {'Owners','ID:Rank'} \\ --
local Teams = {
--[OFDL] Old Football Development League
['Lua Lions'] = {
Logo = 2947056771;
RGB = Color(151, 0, 0);
RGB2 = Color(196, 40, 28);
BC = BrickColor.new('Crimson');
BC2 = BrickColor.new('Bright red');
GroupID = 8342125;
PlaceID = 6131002605;
AdminRanks = {
};
};
}
Note: This script is a local script. GameValues is a configuration folder in replicatedstorage with a bunch of held values for the scoreboard. This line of code works in other games, but not this one. There are also already teams named after the one(s) in teaminfo.
Here is the script:
local Parent = script.Parent
local ABG = Parent.ABG
local HBG = Parent.HBG
local Underlay = Parent.Underlay
local ClockInfo = Parent.ClockInfo
local MainTime = ClockInfo.MainTime
local PC = ClockInfo.PC
local Down = ClockInfo.Down
local Time = MainTime.Time
local Quarter = MainTime.Quarter
local HScore = HBG.Score
local HTeam = HBG.Team
local AScore = ABG.Score
local ATeam = ABG.Team
local HP = Underlay.HP
local AP = Underlay.AP
local Flag = Parent.Flag
local Review = Parent.Review
local CountTime = 0
local Counting = false
local TeamInfo = require(game.ReplicatedStorage:WaitForChild('TeamInformation'))
for i, v in pairs(game.ReplicatedStorage.GameValues:GetChildren()) do
if v.Name == 'Away' then
if v.Value then
local Last;
for word in v.Value.Name:gmatch("%S+") do
Last = word
end
ABG.Team.Text = string.upper(Last)
if v.Value.Name ~= 'Away' then
ABG.BackgroundColor3 = TeamInfo[v.Value.Name].RGB
end
end
elseif v.Name == 'Home' then
if v.Value then
local Last;
for word in v.Value.Name:gmatch("%S+") do
Last = word
end
HBG.Team.Text = string.upper(Last)
HBG.BackgroundColor3 = TeamInfo[v.Value.Name].RGB
end
end
end
or it can be this line thats causing the issue, or can be both:
for i, v in pairs(game.ReplicatedStorage:WaitForChild('GameValues'):GetChildren()) do
v.Changed:Connect(function()
if v.Name == 'Away' then
if v.Value then
local Last;
for word in v.Value.Name:gmatch("%S+") do
Last = word
end
ABG.Team.Text = string.upper(Last)
if TeamInfo[v.Value.Name] then
ABG.BackgroundColor3 = TeamInfo[v.Value.Name].RGB
end
end
elseif v.Name == 'Home' then
if v.Value then
local Last;
for word in v.Value.Name:gmatch("%S+") do
Last = word
end
HBG.Team.Text = string.upper(Last)
if TeamInfo[v.Value.Name] then
HBG.BackgroundColor3 = TeamInfo[v.Value.Name].RGB
end
end
end
end)
end