#Why this think dont work?

1 messages · Page 1 of 1 (latest)

sturdy heart
#
import { world } from 'mojang-minecraft'
import { ActionForm, MessageForm } from "../../Papers/FormPaper.js";
import { ExplosionOptions } from 'mojang-minecraft'

//Form Creation
let form1 = new ui.ActionFormData()
form1.title("§b§lMENU")
form1.body("§7--------------------------------\n§bWelcome To §cStem§7-§a11\n§7--------------------------------
")
//Starts at 0
form1.button("§bSpawn")
form1.button("§abWild")
form1.button("§cPvp")

let form2 = new ui.ActionFormData()
form2.title("§bWild")
form2.body("Teleports You To Random Place")
form2.button("§aTeleport")

function page1(player) {
    form1.show(player).then(result => {
        let selection = result.selection
        if (selection == 0) {
            player.runCommand(
                "tp @s 0 64 20"
            )
        }
        if (selection == 1) {
            page2(player)
            
        }
        if (selection == 2) {
            player.runCommand(
                "tp @s 0 64 0"
                )
        }
        
    })
}

function page2(player) {
    form2.show(player).then(result => {
        let selection = result.selection
        if (selection == 0) {
            player.runCommand(
                "function wild"
                )
        }
    })
}

world.events.beforeItemUse.subscribe(eventData => {
    let player = eventData.source
    let item = eventData.item

    if (item.id == "minecraft:compass") {
        page1(player)
    }
})```
static moatBOT
#
Debug Result

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

stoic glade
sturdy heart
#

1.19.61

fading swift
sturdy heart
fading swift
fresh umbraBOT
#
Script API manifest.json

v1.19.50.21+

{
    "format_version": 2,
    "header": {
        "name": "Bedrock Addons",
        "description": "Script API Template",
        "uuid": "bf67828b-e511-4c72-9922-b6dc179926f4",
        "version": [ 0, 1, 0 ],
        "min_engine_version": [ 1, 19, 50 ]
    },
    "modules": [
        {
            "type": "script",
            "language": "javascript",
            "uuid": "b7055392-4154-4aa8-813f-afa6291f1056",
            "entry": "scripts/server/script.js",
            "version": [ 0, 1, 0 ]
        }
    ],
    
    // to use eval() and Function()
    "capabilities": [ "script_eval" ],

    "dependencies": [
        {
            "module_name": "@minecraft/server",
            "version": "1.1.0-beta"
        },
        {
            "module_name": "@minecraft/server-ui",
            "version": "1.0.0-beta"
        }
    ]
}

?uuids in #bot-usage for the complete list of uuids

sturdy heart
#

?script main.j

fresh umbraBOT
#
Canceling Watchdog Termination

1. Required import

import {system} from "@minecraft/server";

2. Cancellation of Watchdog Termination

system.events.beforeWatchdogTerminate.subscribe(eventData=>eventData.cancel = true);

Available in @minecraft/server module via module version 1.0.0-beta and above.

sturdy heart
#

?script index.js

fresh umbraBOT
#
Learn Javascript!

As the Script API is a framework built on JavaScript code, having an understanding of JavaScript is key.

If you are being shown this, then you most likely are a beginner with JS and could use a little guidance.

📺 Videos on Learning JavaScript
Javascript in 1 hour
Javascript Classes in 1 hour

Web Guide:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide

Reference Sites:
https://www.w3schools.com/jsref/default.asp
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
https://javascript.info

fading swift
#

ur supposed to understand and compare it with urs

#

btw, show ur original manifest

sturdy heart
fading swift
#

u know what to put in the "entry":, right?

sturdy heart
#

no

sturdy heart
fading swift
#

:/

#

aight, send pic of where's files are located in scripts folder

sturdy heart
#

can u send me a mcaddon sample?

sturdy heart
fading swift
sturdy heart
fading swift
#

ur entry should be "entry": "scripts/main.js"

#

just like how u setup tick.json

sturdy heart
sturdy heart
fading swift
#

nice

#

now, what errors u getting now

#

w8

#

before that

sturdy heart
#

none

fading swift
#

oh

sturdy heart
#

idk why theres no error

fading swift
#

did u change the uuid?

sturdy heart
#

no

fading swift
#

close/open MC

sturdy heart
#

the behavior loads but the script dont

sturdy heart
fading swift
#

in ur main.js```js
import { world } from "@minecraft/server";

world.say('hello world')

sturdy heart
#

my main.js
import 'gametests/ui_1';

sturdy heart
#

ok

fading swift
#

for testing yk

sturdy heart
#

its say hello world

#

now the error is the
import * as ui from 'mojang-minecraft-ui'
it say that not found

fading swift
#

find all
mojang-minecraft

replace with
@minecraft/server

sturdy heart
#

the first line also?

fading swift
#

everything

sturdy heart
#

ok ill try

#

no error but dont work

fading swift
#

wdym dont work?

#

does the hello world still display?

sturdy heart
#

yes

#

it display

fading swift
#

@minecraft/server-ui

#

u have that right?

sturdy heart
#

yea

fading swift
#

show the changed one

sturdy heart
sturdy heart
fading swift
#

ok, now

#

change all item.id to item.typeId

sturdy heart
#

then

fading swift
#

also all entity.id or player.id or block.id

#

they changed it to typeId

sturdy heart
#

player.id.runCommandAsync?

fading swift
#

no

#

i mean to get the "minecraft:player" kind of id

sturdy heart
fading swift
#

no

#

still use show(player)

sturdy heart
#

what line do i need to change

fading swift
#

.id == "compass" thing

sturdy heart
fading swift
#

page1(player)

#

thats why the identifier is typeId now

sturdy heart
#

what if i use this

    const { source: entity, item } = eventData;

    if (
        item.typeId !== "minecraft:stick" ||
        item.nameTag !== "Admin Menu"
        || entity.typeId !== "minecraft:player"
        || !entity.hasTag("admin")
    ) {
        return;
    }
    const result = await adminform.show(entity);```
fading swift
#

sure

sturdy heart
#

ill try

#

the error above

fading swift
#

well, that should be easy to fix

sturdy heart
#

how

fading swift
#

paste ur event here

sturdy heart
#
    ActionFormData,
    MessageFormData,
    ModalFormData
} from "@minecraft/server-ui";
import { world } from '@minecraft/server' ;

//Form Creation
let form1 = new ui.ActionFormData();
form1.title("§b§lMENU");
form1.body("§7--------------------------------\n§bWelcome To §cStem§7-§a11\n§7--------------------------------");
//Starts at 0
form1.button("§bSpawn");
form1.button("§abWild");
form1.button("§cPvp");

let form2 = new ui.ActionFormData()
form2.title("§bWild")
form2.body("Teleports You To Random Place")
form2.button("§aTeleport")

function page1(player) {
    form1.show(player).then(result => {
        let selection = result.selection
        if (selection == 0) {
            player.runCommandAsync(
                "tp @s 0 64 20"
            )
        }
        if (selection == 1) {
            page2(player)
            
        }
        if (selection == 2) {
            player.runCommandAsync(
                "tp @s 0 64 0"
                )
        }
        
    })
}

function page2(player) {
    form2.show(player).then(result => {
        let selection = result.selection
        if (selection == 0) {
            player.runCommandAsync(
                "function wild"
                )
        }
    })
}

world.events.beforeItemUse.subscribe(async eventData => {
    const { source: entity, item } = eventData;

    if (
        item.typeId !== "minecraft:compass")
    ) {
        return;
    }
    const result = await form1.show(entity);
}```
fading swift
#

:/

#

item.typeId !== "minecraft:compass")

#

thats the error

sturdy heart
#

what do i do

fading swift
#

thats like

if ( )){
}
#

get what im saying now?

sturdy heart
#

ohh

fading swift
#

what's the next error

#

anyway

#

ill give u this simple logger for reference on what to put in ur code

#
export function createObj(param){
    switch (typeof param) {
        case 'string':
        case 'number':
        case 'boolean':
        case 'undefined': return param;
    }
    if (Array.isArray(param)||Symbol.iterator in param) return Array.from(param,createObj)
    const O = new Object()
    for (const key in param) {
        const value = param[key]
        switch (typeof value) {
            case 'string':
            case 'number':
            case 'boolean': 
            case 'undefined': O[key] = value; continue;
            case 'object': O[key] = createObj(value); continue;
            default: continue;
        }
    } return O
}

use this like

const display = (data) => JSON.stringify(createObj(data),0,5)

world.say(display(eventData))
world.say(display(player))
world.say(display(item))
world.say(display(block))
sturdy heart
#
    const { source: entity, item } = eventData;

    if (
        item.typeId !== "minecraft:compass")
    ) {
        return;
    }
    const result = await form1.show(entity);
}```
#

like this ?

fading swift
#

compass"

sturdy heart
#

("minecraft:compass")?

fading swift
#

no

#

    if (
        item.typeId !== "minecraft:compass")//remove this
    ) {//cus u have it here already
        return;
    }
#

) <<<this one

sturdy heart
#
    const { source: entity, item } = eventData;

    if (
        item.typeId !== "minecraft:compass")
     {
        return;
    }
    const result = await form1.show(entity);
}```
fading swift
#

ok

#

try

sturdy heart
#

ok

fading swift
#

i dont prefer that kind of formatting btw, but that depends on u what makes u read it better

fading swift
#

the }) last part

static moatBOT
#
Debug Result

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

fading swift
#
function createObj(param){
    switch (typeof param) {
        case 'string':
        case 'number':
        case 'boolean':
        case 'undefined': return param;
    }
    if (Array.isArray(param)||Symbol.iterator in param) return Array.from(param,createObj)
    const O = new Object()
    for (const key in param) {
        const value = param[key]
        switch (typeof value) {
            case 'string':
            case 'number':
            case 'boolean': 
            case 'undefined': O[key] = value; continue;
            case 'object': O[key] = createObj(value); continue;
            default: continue;
        }
    } return O
}
console.log(Object.keys(createObj(console)))
#

poggers

vagrant spearBOT
fading swift
#

bruh there's a lot

sturdy heart
#

16:46:25[Scripting][error]-Plugin [Bedrock Addons - 0.1.0] - [main.js] ran with error: [SyntaxError: expecting ',' at gametests/ui_1.js:63

fading swift
#

show whats in 63

vagrant spearBOT
sturdy heart
fresh umbraBOT
#
ScriptAPI - Debug Bot

Here have a test bot dedicated towards debuging script-api code blocks within discord by yourself.

Usage
1. Make sure to use JS Code Block formating
`

console.warn("like this")

2. ` Long press Code Block message

3. Click Apps from the menu

4. Select Debug (Preview) for beta and Debug (Stable) for stable

5. Pog! you should be seeing all the issues, if any

fading swift
# sturdy heart ohh ok that the new error

also

import {
  ActionFormData
} from "@minecraft/server-ui";

let form1 = new ActionFormData();
import * as ui from "@minecraft/server-ui";

let form1 = new ui.ActionFormData();
static moatBOT
#
No errors

No errors in [code](#1074840595383734342 message)

static moatBOT
fading swift
#

choose one

sturdy heart
#

ok

#

the ui works now

#

but the buttons dont

fading swift
#

of course it wont

#

u have to use ur functions

#
if (item.typeId !== "minecraft:compass") return;
page1(entity);
sturdy heart
#

should i remove the const result = await form1.show(entity);
and replace with that?

fading swift
#

yes

sturdy heart
#

ok

fading swift
#

just showing this so u'll understand the difference

function page2(player) {
  form2.show(player).then(result => {
      const selection = result.selection
      if (selection == 0) {
          player.runCommandAsync(
              "function wild"
              )
      }
  })
}```
```js
async function page2(player) {
  const result = await form2.show(player)
  const selection = result.selection
  if (selection == 0) {
      player.runCommandAsync(
          "function wild"
          )
  }
}
sturdy heart
#

the new error the await word

#

i used the first one there no error but dont work

fading swift
#

show code pls

sturdy heart
fading swift
#

use dirt item

#

understand ur code

sturdy heart
#

wait the async i forgot to remove

fading swift
#

world.events.beforeItemUse.subscribe(async eventData => {
  const { source: entity, item } = eventData;

  if (item.typeId !== "minecraft:compass") return;
  page1(entity);
})
tropic cave
sturdy heart
#
import * as ui from "@minecraft/server-ui";
import { world } from '@minecraft/server' ;

//Form Creation
let form1 = new ui.ActionFormData();
form1.title("§b§lMENU");
form1.body("§7--------------------------------\n§bWelcome To §cStem§7-§a11\n§7--------------------------------");
//Starts at 0
form1.button("§bSpawn");
form1.button("§abWild");
form1.button("§cPvp");

let form2 = new ui.ActionFormData()
form2.title("§bWild")
form2.body("Teleports You To Random Place")
form2.button("§aTeleport")

async function page1(player) {
   const result = await form1.show(player)
        const selection = result.selection
        if (selection == 0) {
            player.runCommandAsync(
                "tp @s 0 64 20"
            )
        }
        if (selection == 1) {
            page2(player)
            
        }
        if (selection == 2) {
            player.runCommandAsync(
                "tp @s 0 64 0"
                )
        }
        
        
    }


async function page2(player) {
   const result = await form2.show(player)
        const selection = result.selection
        if (selection == 0) {
            player.runCommandAsync(
                "function wild"
                )
        }
        
    }


world.events.beforeItemUse.subscribe(async eventData => {
    const { source: entity, item } = eventData;

    if (item.typeId !== "minecraft:compass")
    {
        return;page1(entity);
    }


})```
sturdy heart
#

ohh

#

still dont work

fading swift
#

show ur code...

sturdy heart
#
import * as ui from "@minecraft/server-ui";
import { world } from '@minecraft/server' ;

//Form Creation
let form1 = new ui.ActionFormData();
form1.title("§b§lMENU");
form1.body("§7--------------------------------\n§bWelcome To §cStem§7-§a11\n§7--------------------------------");
//Starts at 0
form1.button("§bSpawn");
form1.button("§abWild");
form1.button("§cPvp");

let form2 = new ui.ActionFormData()
form2.title("§bWild")
form2.body("Teleports You To Random Place")
form2.button("§aTeleport")

async function page1(player) {
   const result = await form1.show(player)
        const selection = result.selection
        if (selection == 0) {
            player.runCommandAsync(
                "tp @s 0 64 20"
            )
        }
        if (selection == 1) {
            page2(player)
            
        }
        if (selection == 2) {
            player.runCommandAsync(
                "tp @s 0 64 0"
                )
        }
        
        
    }


async function page2(player) {
   const result = await form2.show(player)
        const selection = result.selection
        if (selection == 0) {
            player.runCommandAsync(
                "function wild"
                )
        }
        
    }


world.events.beforeItemUse.subscribe(async eventData => {
    const { source: entity, item } = eventData;

    if (item.typeId !== "minecraft:compass")
        return;
          page1(entity);


})```
#

now it works

#

thank you

#

i just need to reload tha game

fading swift
#

ok

sturdy heart
# fading swift ok

if i change the type of ui
should it be ?

new ui.MessageFormData
new ui.ModalFormData
fading swift
#

yes

sturdy heart
#

ok thx

static moatBOT
#
No errors

No errors in [code](#1074840595383734342 message)

fleet hull
#

solved ?

sturdy heart
fading swift
#

its basically string methods from ur message

sturdy heart
#
import { world } from '@minecraft/server';


world.events.beforeChat.subscribe(async (eventData) => {
    const player = eventData.sender;
    switch (eventData.message) {
        case '!gmc':
            eventData.cancel = true;
            await player.runCommandAsync('gamemode c');
            break;
        case '!help';
             eventData.cancel = true;
             await player.runCommandAsync('function help');
             break;
        case '!say';
            eventData.cancel = true;
            await player.sendMessage('${args[0]}');
            break;
        case '!gms':
            eventData.cancel = true;
            await player.runCommandAsync('gamemode s');
            break;
        default: break;
    }
});
#

should i use '' or `` on running commands?

#

and the ${args[0]} does it still work? or there new code for it

fading swift
#

Template literals

#

i usually use `` so I can do smth like

const a = 123
let text = 'number: ${a}'
let text2 = `number: ${a}`
console.log(text)
console.log(text2)
vagrant spearBOT
sturdy heart
#

if letters?

#

ok

fading swift
#

same thing

vagrant spearBOT
sturdy heart
#
case '!say';
            eventData.cancel = true;
            const args = 123
            let text = `number: ${args}` ;
            await player.sendMessage(`${args}`);
            break;
fading swift
#

`

sturdy heart
#

that?

fading swift
#

yes

#

but whats args there

#

nvm

sturdy heart
#

ok ill try

fading swift
#

r u fond of rawtext?

sturdy heart
#

idk

fading swift
#
player.tell({rawtext:[{text:`hello my name is ${player.name}`}]})
//or
player.tell(`hello my name is ${player.name}`)
#

.tell() is in .60
.sendMessage() is in .70+

sturdy heart
#

ok

#

i use .tell

#

what if when i do !say haha

#

then the haha say in chat

fading swift
#
const message = '!say hello'
const firstSpace = message.search(' ')
const msg = message.slice(firstSpace)
const cmd = message.slice(0,firstSpace)
console.log(JSON.stringify([msg,cmd]))
fading swift
# sturdy heart what if when i do !say haha
  const player = {
    tell: console.log
  }
const message = '!say hello'

const firstSpace = message.search(' ')
const msg = message.slice(firstSpace).trim()
const cmd = message.trim().slice(0,firstSpace)
  
switch (cmd) {
  case '!say':
    player.tell(msg)
    break;
}
sturdy heart
#

ohh ok

vagrant spearBOT
sturdy heart
#

dont work

fading swift
#

show code what doesnt work, not just saying that w/o context

sturdy heart
#

theres no error

import { world } from '@minecraft/server';


world.events.beforeChat.subscribe(async (eventData) => {
    const player = eventData.sender;
    switch (eventData.message) {
        case '!gmc':
            eventData.cancel = true;
            await player.runCommandAsync('gamemode c');
            break;
        case '!help':
             eventData.cancel = true;
             await player.runCommandAsync('function help');
             break;
        //const message = '!new hello'
        const player = {
    tell: console.log
  }
        const message = '!say hello'

        const firstSpace = message.search(' ')
        const msg = message.slice(firstSpace).trim()
        const cmd = message.trim().slice(0,firstSpace)
  
        switch (cmd) {
           case '!say':
           player.tell(msg)
        break;
}
        case '!gms':
            eventData.cancel = true;
            await player.runCommandAsync('gamemode s');
            break;
        default: break;
    }
});


  

sturdy heart
#

i did

fading swift
#

beforeChat
then paste that

#
world.events.beforeChat.subscribe(async eventData=>{
  const message  = eventData.message
  const player = eventData.sender
  const firstSpace......
sturdy heart
#

the const player?

fading swift
#
switch (cmd){
  case '!say':.....
  case '!gmc':
.....
sturdy heart
#
const player = {
    tell: console.log
  }
        const message = '!say hello'
fading swift
#

no dont include that

#

hehe

sturdy heart
#

ohh ok

#
import { world } from '@minecraft/server';


world.events.beforeChat.subscribe(async (eventData) => {
    const player = eventData.sender;
    const message = eventData.sender;
        const firstSpace = message.search(' ')
        const msg = message.slice(firstSpace).trim()
        const cmd = message.trim().slice(0,firstSpace)
  
    switch (eventData.message) {
        case '!gmc':
            eventData.cancel = true;
            await player.runCommandAsync('gamemode c');
            break;
        case '!help':
             eventData.cancel = true;
             await player.runCommandAsync('function help');
             break;
           case '!say':
           player.tell(msg)
        break;
        case '!gms':
            eventData.cancel = true;
            await player.runCommandAsync('gamemode s');
            break;
        default: break;
    }
});


  

fading swift
#
const message = eventData.message
``````js
switch (cmd){}//not (eventData.message)
sturdy heart
#

iy work now ty

fading swift
#

cool

#

btw, player.tell() is basically /tellraw @s

#

world.say() is /tellraw @a

sturdy heart
#

ok

sturdy heart
fading swift
#

no

sturdy heart
#

ok

#

what the code to run the textField

#

i cant find any in wiki

#
import * as ui from "@minecraft/server-ui";
import { world } from '@minecraft/server';

let loginform = new ui.ModalFormData();
loginform.title("§bLogin");
loginform.textField("Login", "Username");

async function page1(player) {
   const result = await loginform.show(player)
        const formValues = result.formValues
       //idk what to put
       //i want this textField to work when u type a username it run a command
        
    }



world.events.beforeItemUse.subscribe(async eventData => {
    const { source: entity, item } = eventData;

    if (item.typeId !== "minecraft:diamond_sword")
        return;
          page1(entity);


})```
subtle ore
#

It has formValues

sturdy heart
subtle ore
#

Basically

#

That is array

#

formValues Array contains string for textField, boolean for toggle, number for slider and index for dropdown

#

@sturdy heart

#

So if you wanna get value from textField

#

you must have it's index

#

Like you used it on top

sturdy heart
#

how

subtle ore
#

You added it on top right?

sturdy heart
#

yea the formValues

subtle ore
#

The textField

#

Getting values depend on , which sequel you used that

#

In ur case

#

You used like

let form = new ui.ModalFormData()
form.title("Login")
form.textField("UserName","Username")
form.toggle("Remember Me")
let result = form.show(player)
let formValues = result.formValues
//getting value of textField
formValues[0] //you used it on top so its 0
//getting value of toggle
formValues[1] //its on second position so 1

@sturdy heart

#

Don't use const

#

in formValues

#

If you had used toggle first and textField second

#

So ur code will look like

#
let form = new ui.ModalFormData()
form.title("Login")
form.toggle("Remember Me")
form.textField("UserName","Username")
let result = form.show(player)
let formValues = result.formValues
//getting value of toggle
formValues[0] //you used it on top so its 0
//getting value of textField
formValues[1] //its on second position so 1
sturdy heart
#

ok

#

then wht do i add next

subtle ore
#

You can get it value by this

#

And then match it by username

#

And if its matched

#

Or not

#

Run the code

#

Or command

#

Like

#
import * as ui from "@minecraft/server-ui";
import { world } from '@minecraft/server';

let loginform = new ui.ModalFormData();
loginform.title("§bLogin");
loginform.textField("Login", "Username");

async function page1(player) {
   const result = await loginform.show(player)
        let formValues = result.formValues
      let userName = formValues[0] //according to how you sequenced it
if (userName == "Bruh Name") {
player.tell("You Are Accessed")
//your code
} else {
player.tell("Credential Dont Matched")
//kick user or what u want
//code
}
        
    }



world.events.beforeItemUse.subscribe(async eventData => {
    const { source: entity, item } = eventData;

    if (item.typeId !== "minecraft:diamond_sword")
        return;
          page1(entity);


})```
#

@sturdy heart

sturdy heart
#

if type something in the textField it runs the command?

subtle ore
#

Yes

#

Try typing

#

Bruh Name

#

In it

#

And it will say

#

You are accessed

sturdy heart
#

ahh ok thx

subtle ore
#

Wc

sturdy heart
#

if i change this```js
player.tell("Credential Dont Matched")

to
```js
player.runCommandAsync("tag @s add aa") ```
subtle ore
#

Yeah u can but for testing

#

You can try it

sturdy heart
#

do the command only activate on the person who use the ui or the near player will be affected if i use @p?

subtle ore
#

If you use @p then the nearest player would be itself

#

So

#

@s for itself

sturdy heart
#

ok ty again

subtle ore
#

Or there is a method

#
player.addTag("Whatever")
#

and also

#

.

player.removeTag("whatever")
sturdy heart
#

if the player type a name on the textField and run addtag only the name of the person inside the textField?

subtle ore
#

wdym?

sturdy heart
#

example if u type a name in textField and run tag (name from the textField) add member

subtle ore
#

So u want to set tag to the player "member" if credential matched

subtle ore
sturdy heart
#

ok 👌

subtle ore
#

And

#

I will not suggest that way

#

If player had the tag already

#

So he can enter right?

#

So if someone else enter with his name

#

He had already the tag

#

So he can join

#

Without any issue

#

@sturdy heart

sturdy heart
#

ok

#

imma try the script

subtle ore
#

K

sturdy heart
#
if (item.typeId !== "minecraft:diamond_sword")

how to add if u have member tag u cant open the ui

subtle ore
#

So

#

U need

sturdy heart
# subtle ore K

should it be like this ```js
if (item.typeId !== "minecraft:diamond_sword" || player.hasTag("member")

subtle ore
#
if (item.typeId !== "minecraft:diamond_sword") return
if (!entity.hasTag("member") return
page1(entity)
#

entity not player

sturdy heart
#

thx

subtle ore
#

Wait

#

@sturdy heart

#

That was wrong

#
if (item.typeId !== "minecraft:diamond_sword") return
if (!entity.hasTag("member")) return
page1(entity)
#

Try this

#

@sturdy heart

sturdy heart
#

thx

sturdy heart
# subtle ore Try this

if only players that dont have the tag can access and the player that has the tag cant access?

subtle ore
#

Yes

sturdy heart
#

the code do the opposite

#

only the player that has the tag can access and the player dont have the tag cant access

subtle ore
#

Oh

#

So

#

Remove the

#

!

#

Sorry bro

sturdy heart
#

ohh ok ill try

subtle ore
#
if (item.typeId !== "minecraft:diamond_sword") return
if (entity.hasTag("member")) return
page1(entity)
sturdy heart
#

it works ty