Tweening textures in the character triggers FaceChatSelfieView and causes stuttering

When Textures are parented to parts under a character and then tweened, such as modifying its transparency, “CoreScripts/FaceChatSelfieView” causes a long frame time, and for a few seconds after that the client’s performance decreases drastically, before going back to normal.

Microprofiler dump:

Possibly related?: Massive stuttering through "WaitForRenderThread"

Context:
This issue is reproduced in SCP: Roleplay - Roblox when kill effects are enabled via the settings in the menu.
By spawning as a Security Department member (the default team when you join for the first time), and walking forwards til you find “Class - D Cells” (the large area outside the spawn), you should be able to experience this on Computer after waiting for a bit.

This occurs specifically when a player is killed by someone who has kill effects, causing a large performance decrease until the character despawns.

This is an example of code that triggers the performance decrease in-game:

task.spawn(function()
			for i, v in ipairs(Character:GetDescendants()) do
				if v.ClassName == "ObjectValue" and v.Value then
					for _, x in ipairs(v.Value:GetDescendants()) do
						if (x:IsA('BasePart') and x.Name ~= "HumanoidRootPart" and x.Name ~= "Handle") or x.ClassName == "Decal" or x.ClassName == "Texture" then
							if x.ClassName == "Decal" or x.ClassName == "Texture" then
								TweenService:Create(x, TweenInfo.new(Players.RespawnTime), { Color3 = Color3.fromRGB(0, 0, 0) }):Play()
							else
								TweenService:Create(x, TweenInfo.new(Players.RespawnTime), { Color = Color3.fromRGB(0, 0, 0) }):Play()
							end
						end
					end
				elseif (v:IsA('BasePart') and v.Name ~= "HumanoidRootPart" and v.Name ~= "Handle") or v.ClassName == "Decal" or v.ClassName == "Texture" then
					if v.ClassName == "Decal" or v.ClassName == "Texture" then
						TweenService:Create(v, TweenInfo.new(Players.RespawnTime), { Color3 = Color3.fromRGB(0, 0, 0) }):Play()
					else
						TweenService:Create(v, TweenInfo.new(Players.RespawnTime), { Color = Color3.fromRGB(0, 0, 0) }):Play()
					end
				end
			end
		end)
		
		for i, v in ipairs(Character:GetDescendants()) do
			if v:IsA('BasePart') and v.Name ~= "HumanoidRootPart" and v.Name ~= "Handle" then
				local Clone = ReplicatedStorage:WaitForChild("ParticleSkins").Stars:Clone()
				Clone.Name = "SkinParticles"
				Clone.Parent = v
				
				Clone = ReplicatedStorage:WaitForChild("ParticleSkins").Space:Clone()
				Clone.Name = "SkinParticles"
				Clone.Parent = v
				
				Clone = ReplicatedStorage:WaitForChild("ParticleSkins").Space2:Clone()
				Clone.Name = "SkinParticles"
				Clone.Parent = v
			end
		end
2 Likes