Is there a way to prevent player characters from flickering when constantly changing texture properties, e.g. Rainbow Transition? Most likely a bug

When constantly changing something from a character, be it a texture asset id, or a color, if you change something constantly on a second player, weird things happen.

However, these weird things do not happen if the “Humanoid” is deleted. However, you need the “Humanoid”, so this isn’t really a solution at all.

This is most likely a bug with the game, and I’d like to discuss about it, in hope that Roblox devs see it and fix this.

 

All you need to do, is the following.

Create a script and put it inside “ServerScriptService”. This should be the content.

_G.bugTest = true

local t = 6;

local Player1 = game.Workspace:WaitForChild("Player1")
local Player2 = game.Workspace:WaitForChild("Player2")

while (_G.bugTest) do
	task.wait()

	local hue = tick() % t / t

	local rgb = Color3.fromHSV(hue, 1, 1)

	Player1["Body Colors"].HeadColor3 = rgb
	Player2["Body Colors"].RightArmColor3 = rgb
end

The next part, is to go to the “Test” tab in Studio, and choose 2 Players and click on Play.
image

And then you should see something like this.

 

And that’s how you can reproduce my issue. So the issue is, is that the other player starts to flicker. The textures and everything else of the character that you’re playing. E.g. if you’re playing as “Player1” you’d see “Player2” flickering.

And “Player2” would see you flickering.

With flickering, I mean that the “Player2” turns into the textures of “Player1” for a very short moment. With textures this includes, any types of asset that is an image, and colors.

 

I don’t know why this happens, but I think it is related to “Humanoid”. I hope this gets fixed, because I think this issue has been existing for a while now.

As example, when you load in some game with lots of asset and loading time, sometimes you’d see the clothings of another character, applied onto your own character.

5 Likes

Regarding to this issue, it gets even more weird.

This is what the client sees:
image

And this is what the server sees:
image

I tried a workaround.

So, you could like clone the head and weld it.

However, there’s an issue.

The decals on the actual “Head” become pixelated. While on a “fake head” it doesn’t. It would look weird when zoomed out. And I have not found a way to turn the decals on the fake head, pixelated like on the actual “Humanoid’s Head”…

so…

yeah i tried your script, tried to fix it and nothing worked. looks like your rgb code breaks the roblox engine. i recommend looking for a different method to do this

for the rgb body you can copy all the parts and put it there

but for quickly swapping out textures, not possible unless you wanna have weird outlines on transparent decals idk

Update to this, since I’ve reported this flickering issue.

This is regarding the decals, as example if you wanna change the face rapidly fast or any kind of textures. With decals it doesn’t appear pixelated but it will have an outline. And the “face” or any decal applied to a Part that belongs to the Humanoid, will become pixelated, as if it would be directly drawing to the player’s skin, which is really interesting.

Since changing textures fast also causes the flickering issue.

Later I figured out a precise cause of what causes these outlines.

Regarding the outlines, I found out that when you take the ViewportFrame as an example, if you remove the background, I noticed it has a black outline as well. And changing the BackgroundColor also changed the outline.

1 Like

Hello,

Thank you for these really detailed reproduction steps, it is much appreciated.

The flickering occasionally happens when using the old style avatars, non surface appearance. There are a couple separate reasons for this, but I won’t bore you with the details as to why. The flickering, where a character seems to disappear only happens on very low end hardware, due to a time budget in the frame to rebuild the avatar data (after that time, the rendering representation of the avatar is deleted, but not immediately rebuilt that frame, leading to a flicker.). We will look into fixing this again, but it isn’t as simple as just fixing it. It has memory implications, because we have to track the old version and only swap the new version when it is ready. This means we can temporarily have multiple data sets for an avatar in memory, which might lead to OOM, so we need to be cautious for that.

The colors changing at different frequencies is ‘by design’ in order to not overload the system when invalidating large amounts of data. For the state of the colors being different in the client vs server views… this is normal, works as intended and has to do with network replication. I’m not a networking programmer, but short version is something like. If the server changes the color, then it will see it immediately. Then it sends a signal (for replicated properties) to all the clients to also change the color. However this signal needs to travel over the network to the client and this takes and arbitrary time. After that arbitrary time the client queues up the state change for the next frame and then displays it… at this point the server is likely a frame or two ahead, so it already has different colors.

In real Roblox, like a normal game you play, the server doesn’t render the avatars, it just simulates and updates clients who do render. But depending on the time between the different clients they may see slightly different values, which is expected.

(If you are interested in this topic, google search for “network replication for games” or something along those lines, and you get an in depth description.)

3 Likes

There are some workarounds, like copying the body parts of the player.

But for the face texture or any other texture, it doesn’t work.

The face on the avatar is pixelated by default. If I would be copying the “Head” and re-naming it to “FakeHead” or similar and place a “Decal” on it. The Decal appears in a more higher resolution. But if you move further away, you’d see an outline on it which doesn’t look great, hence why that wouldn’t work.

Regarding low end specs, unsure, many I’ve asked were able to reproduce this issue.

I wanted to test it with EditableImage, but it seems like it doesn’t even work on Humanoid stuff

_G.bugTest = true

local t = 6;

local Player1 = game.Workspace:WaitForChild("Player1")
local Player2 = game.Workspace:WaitForChild("Player2")


function initFaceModification(plyChar)
	local Head = plyChar:WaitForChild("Head")
	local face: Decal = Head:WaitForChild("face")
	
	if (face:FindFirstChildOfClass("EditableImage")) then
		return
	end

	game.AssetService:CreateEditableImageAsync(face.Texture).Parent = face
end


function modifyFaceTexture(plyChar: Model)
	local Head = plyChar:FindFirstChild("Head")
	local face: Decal = Head:FindFirstChild("face")
	local editableImage = face:FindFirstChildOfClass("EditableImage")


	local pixels = editableImage:ReadPixels(
		Vector2.zero,
		editableImage.Size
	)

	for i=1, (editableImage.Size.X * editableImage.Size.Y) do
		local pixelIndex = 1 + ( (i - 1) * 4 )
		pixels[pixelIndex] = math.random()
		pixels[pixelIndex + 1] = math.random()
		pixels[pixelIndex + 2] = math.random()
	end

	editableImage:WritePixels(
		Vector2.zero,
		editableImage.Size,
		pixels
	)
end

initFaceModification(game.Workspace.Model)
initFaceModification(Player1)
initFaceModification(Player2)


while (_G.bugTest) do
	task.wait()

	local hue = tick() % t / t

	local rgb = Color3.fromHSV(hue, 1, 1)
	
	modifyFaceTexture(game.Workspace.Model)
	modifyFaceTexture(Player1)
	modifyFaceTexture(Player2)
end

 

@FGmm_r2