[FIXED] help fixing an error with plugin code (error at line 58)

the error says "cannot read property "bitmap" of undefined"
//============================================================================= // CustomTextPositionPlugin.js //============================================================================= /*: * @plugindesc Allows you to adjust the position of custom text in the menu. * * @param Custom Text * @desc The initial text to display when the custom option is selected. * @default Hello from your custom menu option! * * @param Text X Position * @desc The X coordinate for the custom text. * @default 100 * * @param Text Y Position * @desc The Y coordinate for the custom text. * @default 200 * * @help * This plugin allows you to display custom text at specific X and Y positions * in the menu without interfering with other elements. * * Plugin Commands: * - ChangeCustomText [newText] * Example: ChangeCustomText New message here! * Changes the custom text to the specified [newText]. */ (function() { var parameters = PluginManager.parameters('CustomTextPositionPlugin'); var customText = String(parameters['Custom Text'] || 'Hello from your custom menu option!'); var textX = Number(parameters['Text X Position'] || 100); var textY = Number(parameters['Text Y Position'] || 200); // Add the custom text to the menu scene var _Scene_Menu_create = Scene_Menu.prototype.create; Scene_Menu.prototype.create = function() { _Scene_Menu_create.call(this); this.createCustomText(); }; Scene_Menu.prototype.createCustomText = function() { this._customTextSprite = new Sprite(); this._customTextSprite.bitmap = new Bitmap(200, 48); // Adjust dimensions as needed this._customTextSprite.bitmap.drawText(customText, 0, 0, 200, 48, 'left'); this._customTextSprite.x = textX; this._customTextSprite.y = textY; this.addChild(this._customTextSprite); }; // Plugin command to change the custom text var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function(command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'ChangeCustomText') { customText = args.join(' '); this._customTextSprite.bitmap.clear(); this._customTextSprite.bitmap.drawText(customText, 0, 0, 200, 48, 'left'); } }; })();
fixed it by just initializing it using before clearing it

this._customTextSprite = new Sprite(); this._customTextSprite.bitmap = new Bitmap(200, 48);
For future reference, when you do need help, please don't paste entire plugins into the contents of your post.

You can use the Attach File button, or it's preferred to just provide a link to where you downloaded it from. Many authors prohibit redistribution in their terms of use.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/fixed-help-fixing-an-error-with-plugin-code-error-at-line-58.166030/