Is the transparency tween change the way of color looks

So i’ve got a piece of code that changes the transparency by tweening and a color but when the transparency tweens the color alo change with it i cannot really explain it but here is a vid :

and here is the code

Color.OnServerEvent:Connect(function(plr, PartColor, Boolean)


			if Boolean == true then
				for _, Part :BasePart in pairs(CloneMap.ChangeableParts:GetDescendants()) do
					if Part:IsA("BasePart") and Part.BrickColor.Name ~= PartColor then
						local tween = TweenService:Create(Part, Info, {Transparency = 1})
						tween:Play()
						tween.Completed:Connect(function()
							Part.CanCollide = false
						end)
					end
				end

			else
				for _, Part in pairs(CloneMap.ChangeableParts:GetDescendants()) do
					if Part:IsA("BasePart") then
						local tween = TweenService:Create(Part, Info, {Transparency = 0})
						tween:Play()
						Part.CanCollide = true
					end
				end

				for _, Part in pairs(CloneMap.ChangeableParts:GetDescendants()) do
					if Part:IsA("BasePart") then
						local randomColor = keys[math.random(1, #keys)]
						Part.BrickColor = ColorTable[randomColor]
					end
				end
			end


		end)
1 Like

I would guess it happens because the function first runs where the Boolean parameter is set to false, which will change all the parts’ colors, and then the function runs again when the Boolean parameter is true, which will tween their transparency. I suppose it happens because of some problem in the LocalScript which fires the Color RemoteEvent twice. Could you post the LocalScript here so I can take a look at it?

1 Like
local InRound = game:WaitForChild("ReplicatedStorage"):WaitForChild("InRound")
local Statut = game:WaitForChild("ReplicatedStorage"):WaitForChild("Status")
local Color = game:WaitForChild("ReplicatedStorage"):WaitForChild("Remotes"):WaitForChild("Color")
local ColorDisplay = game:WaitForChild("ReplicatedStorage"):WaitForChild("Others"):WaitForChild("ColorDisplay")
local Intermissions = script.Parent.Intermissions

local ColorTable = require(game.ReplicatedStorage:WaitForChild("Modules"):WaitForChild("Configuration"))["Rounds Configuration"].ColorsTable

local Color3Table = {
	["Yellow"] = Color3.fromRGB(255, 255, 0);
	["Red"] = Color3.fromRGB(255, 0, 0);
	["Blue"] = Color3.fromRGB(0, 0, 255);
	["Green"] = Color3.fromRGB(0, 255, 0);
	["Pink"] = Color3.fromRGB(255, 102, 204);
	["Cyan"] = Color3.fromRGB(0, 255, 255);
	["Purple"] = Color3.fromRGB(107, 50, 124)
}

game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed = 20

function abbreviateNumber(number)
	local abbreviations = {"K", "M", "B", "T", "Qa", "Qi", "Sx", "Sp", "Oc", "No", "Dc", "UDc", "DDc", "TDc", "QaDc", "QiDc", "SxDc", "SpDc", "ODc", "NDc", "V", "UV", "DV", "TV", "QaV", "QiV", "SxV", "SpV", "OV", "NV"}

	local power = math.floor(math.log10(number) / 3)
	local abbreviation = abbreviations[power]

	if abbreviation then
		local abbreviatedNumber = number / (10^(power * 3))
		local formattedNumber = string.format("%." .. (abbreviatedNumber % 1 == 0 and 0 or 2) .. "f%s", abbreviatedNumber, abbreviation)
		return formattedNumber
	else
		return tostring(number)
	end
end

Intermissions.Text = Statut.Value

local keys = {}
for key, _ in pairs(ColorTable) do
	table.insert(keys, key)
end

InRound:GetPropertyChangedSignal("Value"):Connect(function()
	if InRound.Value == true then
		local CloneColorDisplay = ColorDisplay:Clone()
		CloneColorDisplay.Parent = script.Parent
		while true do
			local randomKey = keys[math.random(1, #keys)]

			if CloneColorDisplay ~= nil then
				CloneColorDisplay.BackgroundColor3 = Color3Table[randomKey]
				CloneColorDisplay.ColorText.Text = randomKey

				for i  = 5, 0, -1 do
					CloneColorDisplay:WaitForChild("Timer").Text = i
					wait(1)
				end

				Color:FireServer(randomKey, true)
				
				task.wait()

				for i = 3, 0, -1 do
					if CloneColorDisplay.Timer then
						CloneColorDisplay.Timer.Text = i
						task.wait(1)
					end
				end

				Color:FireServer(randomKey, false)
			end
			task.wait()
		end
	else
		for _, Frame in pairs(script.Parent:GetChildren()) do
			if Frame:IsA("Frame") and Frame.Name == "ColorDisplay" then
				Frame:Destroy()
			end
		end
	end
end)

Statut:GetPropertyChangedSignal("Value"):Connect(function()
	Intermissions.Text = Statut.Value
end)
1 Like

I’m guessing it might have something to do with this, if we are talking about the same thing.
The cyan color is changing?

1 Like

Thx for responding, but iwhat i’m talking about IS that i didnt call any color changing in the for loop in thé true boolean but thé color even if there IS no color changing stuff in the for loop