Game prints num 0 when its actually above 0

local function GetColorPaintedPercent(Color)
	
	local CS = game:GetService("CollectionService")
	
	local TotalPlatesPainted = 0
	
	for _, GamePlate in pairs(CS:GetTagged("GamePlate")) do
		
		if GamePlate.TeamClaimed.Value ~= "" then
			
			TotalPlatesPainted += 1
			
		end
		
	end
	
	local TotalPlatesPaintedTargetColor = 0
	
	for _, GamePlate in pairs(CS:GetTagged("GamePlate")) do

		if GamePlate.TeamClaimed.Value ~= "" and GamePlate.TeamClaimed.Value == Color then

			TotalPlatesPaintedTargetColor += 1

		end

	end
	
	print(TotalPlatesPaintedTargetColor)
	
	return math.floor((TotalPlatesPaintedTargetColor / TotalPlatesPainted) * 100)
	
end

This line prints 0 print(TotalPlatesPaintedTargetColor) messing up the whole calculation

What kind of instance is GamePlate.TeamClaimed, and where are you calling GetColorPaintedPercent() and with what parameter?

The parameter is a string and TeamClaimed is a stringvalue

1 Like

in the loop print what the stringValue returns and also print the color parameter, maybe you are confusing types because when I see “color” I think of a color3

It prints “Red” “Green” “Blue”

And your color parameter prints what? doesn’t print any of those right?

Thats what it prints “Red” “Green” “Blue”

Your value prints the same?

Are you talking about this?

that and GamePlate.TeamClaimed.Value

That is also Red Green and Blue bc whenever a player touches the plate then it sets the TeamClaimed to the player’s AssignedTeam (string value)

For some reason sometimes it prints my placeholder test text “wdahw”