recently started using Rojo, so Copilot can help me with a lot of complicated issues. but it kind of struggles with its organization (if that isn’t a problem for you then GO AWAY
).
i want to know this is readable to the normal eye at all. if you want any additional context then just let me know!
---------------------------------
-- variables
---------------------------------
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Events = ReplicatedStorage:FindFirstChild("events")
;
---------------------------------
-- events
---------------------------------
local scoreEvent = Events:FindFirstChild("boardChange")
local currentScores = {}
setmetatable(currentScores, {__index = function(t, k) return rawget(t, k, 0) or 0 end})
-- if theres no team, try getting its value. otherwise return 0
local connections = {}
local values = script.Parent.Runtime.Values
local function updateBoard(updateNumber:number)
if updateNumber == 1 then
local homeScore = values:FindFirstChild("HomeScore").Value
local awayScore = values:FindFirstChild("AwayScore").Value
table.insert(currentScores, 1, homeScore.Value.Changed:Connect(function()
currentScores["Home"] = homeScore.Value
end))
table.insert(currentScores, 1, awayScore.Value.Changed:Connect(function()
currentScores["Away"] = awayScore.Value
end))
if currentScores["Home"] ~= homeScore.Value or currentScores["Away"] ~= awayScore.Value then
-- if scores arent the same, tell client to update
scoreEvent:FireAllClients(currentScores)
end
end
end
keep in mind a lot of the stuff might just not work or has some logical errors like the setmetatable(), but i just wanna know if the structure is solid since some of the scripts have the same structure.