#The event code doesn't work PlayerEvents.chat

20 messages · Page 1 of 1 (latest)

autumn wing
#

This code should write a message to the chat after the word "Hi! But for some reason it's not happening. Please help me.

main martenBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

bronze emberBOT
#

Paste version of example.js from @autumn wing

prime cave
#

If you lowercase, it will never match "Hi!"

#

H is capital

autumn wing
#

I have changed everything to lower case, but still nothing happens

heady seal
#

they are saying your condition is capitalized

#

even though the thing you are checking is being sent to lowercase

autumn wing
#

It's weird because I took the sample code from the wiki

autumn wing
prime cave
#

But you had Hi

#

What file are you putting this code in and in what folder?

#

It should be server scripts

autumn wing
#

Yeah, I changed it

#

it's in the server scripts

prime cave
#

hold on

#
PlayerEvents.chat(event => {
    if (event.message.toLowerCase().includes('hi!')) {
        event.getServer().scheduleInTicks(6, ctx => {
            event.player.tell(Text.blue('Welcome!'))
        })
    }
})```
autumn wing
#

Everything works, thank you very much!