Nope. Comparing Color3 to Color3.
is the variable Instance? or was that just an example? Because if it is, try changing it to something else and see if it works.
Instance is an example. > char limit
Honestly you should revise the code to compare brickcolors instead of color3s. It isn’t necessary at all and could be the problem.
can I see what your script was for that? Because it worked just fine for me.
Hey, I just noticed your previous code. Try this and see if it works.
if Instance.Color == C3.Color then
Instance.Color = Color3.new(1,1,1)
end
C3 is Color3 already > char limit
Alright how about this then.
if Instance.Color == C3.Value then
Instance.Color = Color3.new(1,1,1)
end
for _,i in pairs(workspace.Baseplate.Cities[countryName]:GetChildren())do
local region = workspace.Baseplate.Parts:FindFirstChild(i:GetAttribute("Region"))
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)
if region and raycastResult and raycastResult.Instance==region and raycastResult.Instance.Color==workspace.CountryData[countryName].C3.Value then
region.Color=Color3.new(1.0, 1.0, 1.0)
end
i.BrickColor=BrickColor.Red()
end
Edit to clarify, raycastResult is going through. I have checked. Also, variables are written above in the script and work. The issue is with colours
I’m not sure what this is. I’ve ran into 3 unfixable problems already and I have no idea how any of this is happening.
Show us the errors, if any. (chat limit)))))))
No error. > chat limit chat limit
Hmm, that means your script is working, but something in it is nil. Try changing some of your things to FindFirstChild() or WaitForChild().
Made sure everything is all there.
It doesn’t necessarily mean that something is nil. It just means that the intended result wasn’t achieved.
Also, I’m just going to say that “Attributes” aren’t very… good I guess? Like, they do work, but a lot of times they don’t work for me and are just a waste of time honestly. So, if anything, I’d recommend using a value or something for it instead.
I was going to script the game first then go for a second round of optimization.
Right now, I’m guessing all your parts are red when you play test it?
No, they’re the same colour as the country territory
Edit: they turn red when you select a country to play as
Imo you should make it as optimized as possible the first round then if you really need to do a second round then do it.