#script doesn’t run

1 messages · Page 1 of 1 (latest)

night iceBOT
#
Debug Result

JavaScript/TypeScript code blocks not detected in [message](#1080944631082131608 message ).
Example:
```js
console.log("Hi mom!")
```

coral oxide
#

@steel timber

#

Send the code in the format shown above

steel timber
# coral oxide Send the code in the format shown above
world.events.beforeItemUse.subscribe(({item, source}) => {
    source.addTag(`itemUse:${item.typeId}`)
    if(item.nameTag) source.addTag(`itemUseName:${item.nameTag}`)
    setTickTimeout(() => {
        source.removeTag(`itemUse:${item.typeId}`)
        source.removeTag(`itemUseName:${item.nameTag}`)
    }, 1)
})

world.events.beforeItemUseOn.subscribe(({item, source}) => {
    source.addTag(`itemUseOn:${item.typeId}`)
    if(item.nameTag) source.addTag(`itemUseName:${item.nameTag}`)
    setTickTimeout(() => {
        source.removeTag(`itemUseOn:${item.typeId}`)
        source.removeTag(`itemUseName:${item.nameTag}`)
    }, 1)
})


function setTickTimeout(callback, tick){
    let ticks = 0
    let TickCallBack = world.events.tick.subscribe(() => {
        ticks += 1
        
        if(ticks == tick){
            callback()
            world.events.tick.unsubscribe(TickCallBack)
        }
    })
}
night iceBOT
#
No errors

No errors in [code](#1080944631082131608 message)

coral oxide
#

@steel timber Did you import the code?

coral oxide
#

Is it added to your BP manifest?