rojo-rbx / rbx-dom

Roblox DOM and (de)serialization implementation in Rust
MIT License
113 stars 46 forks source link

Setting `BaseScript.Enabled` doesn't affect anything #334

Open hoontee opened 1 year ago

hoontee commented 1 year ago

Critical fix needed if https://github.com/rojo-rbx/rbx-dom/issues/277 isn't already underway. Scripts aren't disabled if setting Enabled = false.

Related: https://github.com/rojo-rbx/rbx-dom/pull/315

kennethloeffler commented 1 year ago

This isn't going to work because Roblox Studio won't load BaseScript.Enabled. Try it out for yourself with this file where I've edited a script to have a serialized Enabled property:

<roblox
 xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
    <Meta name="ExplicitAutoJoints">true</Meta>
    <External>null</External>
    <External>nil</External>
    <Item class="Script" referent="RBX0AA760BFF1DA4F63B313DEA157E76E7F">
        <Properties>
            <BinaryString name="AttributesSerialize"></BinaryString>
            <bool name="Enabled">false</bool>
            <Content name="LinkedSource"><null></null></Content>
            <string name="Name">Script</string>
            <token name="RunContext">0</token>
            <string name="ScriptGuid">{07BBB67B-65A6-4ED3-9F18-26A7182CD2AA}</string>
            <ProtectedString name="Source"><![CDATA[print("Hello world!")
]]></ProtectedString>
            <int64 name="SourceAssetId">-1</int64>
            <BinaryString name="Tags"></BinaryString>
        </Properties>
    </Item>
</roblox>

You'll end up with a script with BaseScript.Enabled set to true