Overwriting a property manually on an Instance that is being overwritten by StyleRule, permanently unlinks that property from StyleRule

Info

System: Windows 10 - 64bit
Studio Version: Version 0.614.0.6140412 (64bit)

Description

Overwriting a property manually on an Instance that is being overwritten by StyleRule, permanently unlinks that property from StyleRule.

e.g. a TextLabel is listening to a StyleRule, which changes the BackgroundColor3 property.
However, if you overwrite the BackgroundColor3 property on the TextLabel, the StyleRule will no longer apply the BackgroundColor3 on it, doesn’t matter what you do. You’re forced to destroy the TextLabel and create an entire new one through a Script, which doesn’t touch the BackgroundColor3 property.

Loading any save file, destroys any links from StyleRule. I believe the reason for that is

  • You Load a save file
  • It initializes Instances, such as their Colors and seems to set the Color property ontop in its own Object again
  • Then StyleRule doesn’t work on it.

Reproduction Steps

Before you start you need the following Fast Flags.

  • {"FFlagEnableStylingEverywhere":true}

 

  1. Get this game:
    bug_repro_stylerule_overwrite.rbxlx (74.4 KB)

  2. Copy paste this code into the console

local TextLabel = Instance.new("TextLabel")
TextLabel.Size = UDim2.new(0.5, 0, 0.5, 0)
TextLabel.Position = UDim2.new(0.25, 0, 0.1707921, 0)

TextLabel.Parent = game:GetService("StarterGui").ScreenGui

TextLabel:AddTag("ControlColor")

  1. Go to .ControlColor and use the Color Picker from the Attribute.
  2. You will notice that the Color changes with the TextLabel’s BackgroundColor3 _(which is intended)
  3. Go to the TextLabel and change the Color Property manually

Now the Color of the TextLabel is no longer synced with StyleRule, doesn’t matter if you re-link the StyleLink. The TextLabel needs to be destroyed and created again.

OR

Run the scripts in these, by copy pasting them into the console
image

Expected Result

That the StyleRule still overrides the color, regardless of TextLabel overriding the color on its own. (well, HTML AND CSS has inline style rule, but this one can’t be controlled with StyleRule yet)

Actual Result

It looks like, if you load a Place or anything like that, if the Instance wasn’t freshly created, StyleRule won’t overwrite the defined properties, in this case it doesn’t overwrite BackgroundColor3.

2 Likes

Thanks for the report! I filed a ticket in our internal database and we’ll follow up when we have an update for you.