ScriptAsset.script returns null

I've got a "MachineBehaviour" script that has a custom property which is an ScriptAsset.
I tried to access the script of the scriptAssetby ( ScriptAsset.script ) , but it returns null , Why?

(Is this how you do it or is there another way?)
(+ I'm still a newbie)

You have a Custom property that is an Asset Reference and you have an Script as it's value?

Then try something like this

local OtherScript = require(script:GetCustomProperty("OtherScript"))

In this example "OtherScript" is the property name and not the Script name.

1 Like