This game will contain more than 10,000 lines of code near the end and around 3200 cities and meshes, not to mention units, flags, countries and everything else.
I know optimization will be a big part in making sure the game is playable but first I need the mechanics down. I am optimizing while going through (which is what this update is) but I don’t want to focus too hard on it without getting the basic features down.
Okay thats fine. Also I don’t mean to screenshot everything in your game, I mean your script, and a small portion of the workspace which showcases the part folder.
It turns red at the last line of the if statement, after parsing through regions. Doesn’t matter though, since C3 isnt a city part. C3 does not change at all. It is static throughout the entire gameplay
for _,i in pairs(workspace.Baseplate.Cities[countryName]:GetChildren())do --get all cities belonging to country
local region = workspace.Baseplate.Parts:FindFirstChild(i:GetAttribute("Region")) --get all provinces relating to that city
local params = RaycastParams.new()
params.FilterType= Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = {workspace.Baseplate.Parts}
local raycastResult = workspace:Raycast(i.Position, Vector3.new(0, -10, 0), params) --check if city is located inside the province
if region and raycastResult and raycastResult.Instance==region and raycastResult.Instance.Color==workspace.CountryData[countryName].C3.Value then --if the province is found, the city is inside the province and the province colour matches with the countries colour
region.Color=Color3.new(1.0, 1.0, 1.0) --set the province colour to white
end
i.BrickColor=BrickColor.Red() --turn the city red
end
The part that is turning red and the mesh that is turning white are completely different.
The former works perfectly fine and is only used twice. Once to set it to red, another to determine the region it belongs to.
Tried converting both colors to Color3 then comparing
Tried doing the same with BrickColor instead
Tried doing both except changing just one colour
Tried restarting studio
Tried scanning for all meshparts sharing the wanted colour
Tried converting both to strings and comparing those