[SOLVED] Unable to add a script to a script component in code

Do you have a link to the project or code?

:joy:I just want to know the simplest way to add a component…I have tried official code,but it doesn’t work.

If it’s to do with the project you sent me:

Your script filename is pluse.js but you have given it the script name pulse
image

When you are adding a component, you need to use the script name, not the filename.

ie

ctrlBtnsGrp[i].script.create("pulse", {

NOT

ctrlBtnsGrp[i].script.create("pluse", {

Oh,my god:joy::joy::joy::joy::joy::joy::joy::joy::joy::joy::joy::joy:

:joy:I hate javascript

This could also work

var name = pc.createScript('name');
name.attributes.add('name', { type: 'type', default: 'default' )};

// you can modify this so it can be used for sprites

:ok_hand::ok_hand::ok_hand::ok_hand::ok_hand::ok_hand: