So, I’m trying to check if the game needs to stop if a team gets 4 points, but for some reason its clearing the value after the script puts the value into the dictionary. I don’t know what is going on, so any help will be appreciated.
Script:
local values = {
["Red"] = 0;
["Blue"] = 0
}
for i, v in pairs(game.Teams:GetDescendants()) do
if v:IsA("NumberValue") then
values[v.Name] = v.Value
print(v.Parent.Name..": "..values[v.Name])
end
end
--something happens here that makes the values = nil but i didn't put
--anything here
print("| "..values.Red.."| "..values.Blue.."| "..val.Value.." |")
The Prints: