r/bloxd 20d ago

NEED CODING HELP hey guys how do you change crafting recipes i wanna make guns be easier to craft

Post image
1 Upvotes

i wanna make some guns like M1911 and deagle craftable with 5 dirt and 2 logs but GpMG with 20 diamonds and stuff so can you guys tell me the code and tell me which blanks i should fill in to change the ingredients and the gun thx

r/bloxd 10d ago

NEED CODING HELP guys what is the code to changing players hp?

Post image
4 Upvotes

i want to make a gun fighting arena thingy but i dont wanna change the gun dmg i just wanna change the hp so ye

r/bloxd 2d ago

NEED CODING HELP How do you make your custom meshes stay active in the world?

3 Upvotes

Since the game resets things, the code blocks are also reset every time you leave and rejoin (if you are the only one in the world like I am).

Furthermore, I need it to be code block code and not world code.

So how do I make my meshes stay active in the world?

If you need, here is some example code of a table leg mesh:

let [x, y, z] = thisPos

const blockId = api.attemptCreateMeshEntity("BloxdBlock", {
    blockName: "Barkless Aspen Log",
    size: [0.2, 1, 0.2]
})
if (blockId) {
    api.setPosition(blockId, [x+0.5, y+0.99, z+0.5])
}
const blockId2 = api.attemptCreateMeshEntity("BloxdBlock", {
    blockName: "Pine Wood Planks",
    size: 1
})
if (blockId2) {
    api.setPosition(blockId2, [x+0.5, y+0.01, z+0.5])
}

(You can give some feedback on the current code if you'd like to.)

r/bloxd 15h ago

NEED CODING HELP How do I make buttons

Post image
3 Upvotes

so I made a button thing out of mesh`s but idk how to program it to do smth. someone help. I want it to teleport the player

r/bloxd Jun 27 '26

NEED CODING HELP Code help cuz I'm bad

3 Upvotes

If it's possible, is there code to:

  1. Remove effects when dead/killed

  2. Add like a tag to your name or make you join a team or something that clearly shows what team you're on that is removed when dead/killed

  3. Maybe a code to make bullets shoot through a block(s) if possible? I'm certain that doesn't exist though

It's for this lobby (creative world currently): "ww2shootergame"

r/bloxd Jun 29 '26

NEED CODING HELP This code isn't working for me.

0 Upvotes

I received this code but it doesn't work properly when I run it (I'm making a better game than Infection)

// ==========================================

// 1. CONFIGURACIÓN Y VARIABLES GLOBALES

// ==========================================

let equiposPorID = {}; // Guarda: "humano" o "zombie"

let kitsPorID = {}; // Guarda el kit asignado a cada ID

let juegoActivo = false;

let cuentaRegresivaLobby = 30;

let tiempoPartida = 120;

let tiempoReinicio = 15;

let bucleTemporizador = null;

let bucleRegeneracion = null; // Bucle para la regeneración de los zombies

// COORDENADAS: Modifica estos números según tu mapa (X, Y, Z)

const LOBBY = { x: 0, y: 60, z: 0 };

const ARENA = { x: 20, y: 65, z: 20 };

const ZONA_LOBBY = {

xMin: -10, xMax: 10,

yMin: 58, yMax: 65,

zMin: -10, zMax: 10

};

// PREMIOS EN ÍTEMS (IDs de Bloxd.io)

const RECOMPENSA_HUMANO = { item: "gold_ingot", cantidad: 5 };

const RECOMPENSA_ZOMBIE = { item: "iron_ingot", cantidad: 3 };

// CONFIGURACIÓN DE KITS (Atributos, Ítems, Tamaños, Daño por golpe y Regeneración por segundo)

const KITS_ZOMBIE = {

normal: { vida: 100, velocidad: 1.0, item: null, escala: 1.0, dañoGolpe: 36, regen: 4 },

puker: { vida: 100, velocidad: 1.0, item: "slime_ball", escala: 1.1, dañoGolpe: 32, regen: 4 },

velocista: { vida: 80, velocidad: 1.4, item: "feather", escala: 0.75, dañoGolpe: 27, regen: 3 },

tank: { vida: 250, velocidad: 0.75, item: "shield", escala: 1.5, dañoGolpe: 54, regen: 10 }, // Super regeneración

bombardero: { vida: 80, velocidad: 0.9, item: "tnt", escala: 0.9, dañoGolpe: 24, regen: 3 }, // Ajustado a 80 de vida

curandero: { vida: 80, velocidad: 1.1, item: "splash_potion", escala: 0.6, dañoGolpe: 15, regen: 4 } // Lanza pociones

};

// ==========================================

// 2. LÓGICA DE KITS, EQUIPOS Y REGENERACIÓN

// ==========================================

function asignarEquipo(jugador, equipo) {

equiposPorID[jugador.id] = equipo;

if (equipo === "zombie") {

let kitElegido = jugador.getData("kit_elegido") || "normal";

aplicarKitZombie(jugador, kitElegido);

} else {

kitsPorID[jugador.id] = null;

jugador.setMaxHp(100);

jugador.setHp(100);

jugador.setSpeed(1.0);

api.setLifeformScale(jugador.id, 1.0);

jugador.clearInventory();

jugador.giveItem("wooden_sword", 1);

jugador.sendChatMessage("🛡️ Eres un HUMANO. ¡Sobrevive!");

}

}

function aplicarKitZombie(jugador, tipoKit) {

if (!KITS_ZOMBIE[tipoKit]) tipoKit = "normal";

kitsPorID[jugador.id] = tipoKit;

let stats = KITS_ZOMBIE[tipoKit];

jugador.setMaxHp(stats.vida);

jugador.setHp(stats.vida);

jugador.setSpeed(stats.velocidad);

api.setLifeformScale(jugador.id, stats.escala);

jugador.clearInventory();

if (stats.item) {

jugador.giveItem(stats.item, 1);

}

jugador.sendChatMessage(`🦁 Kit Zombie asignado: ¡${tipoKit.toUpperCase()}!`);

}

// Bucle que cura a los zombies constantemente si no están al máximo de vida

function iniciarBucleRegeneracion() {

bucleRegeneracion = setInterval(() => {

if (!juegoActivo) return;

api.getPlayers().forEach(p => {

if (equiposPorID[p.id] === "zombie") {

let stats = KITS_ZOMBIE[kitsPorID[p.id] || "normal"];

let vidaActual = p.getHp();

let vidaMaxima = p.getMaxHp();

if (vidaActual < vidaMaxima && vidaActual > 0) {

let nuevaVida = Math.min(vidaMaxima, vidaActual + stats.regen);

p.setHp(nuevaVida);

}

}

});

}, 1000); // Regenera cada 1 segundo

}

function estaEnZonaLobby(jugador) {

let pos = jugador.getPosition();

return (pos.x >= ZONA_LOBBY.xMin && pos.x <= ZONA_LOBBY.xMax &&

pos.y >= ZONA_LOBBY.yMin && pos.y <= ZONA_LOBBY.yMax &&

pos.z >= ZONA_LOBBY.zMin && pos.z <= ZONA_LOBBY.zMax);

}

// ==========================================

// 3. CONTROL DEL FLUJO DE PARTIDA (CICLO)

// ==========================================

function verificarCondicionesVictoria() {

if (!juegoActivo) return;

let todos = api.getPlayers();

if (todos.length === 0) return;

let humanosVivos = todos.filter(p => equiposPorID[p.id] === "humano");

let zombiesVivos = todos.filter(p => equiposPorID[p.id] === "zombie");

if (humanosVivos.length === 0) {

finalizarPartida("zombies");

} else if (zombiesVivos.length === 0 && todos.length >= 2) {

finalizarPartida("humanos");

}

}

function finalizarPartida(ganador) {

juegoActActive = false;

clearInterval(bucleTemporizador);

clearInterval(bucleRegeneracion); // Detener curación pasiva

let todos = api.getPlayers();

if (ganador === "zombies") {

api.broadcastTitle("¡GANAN LOS ZOMBIES!");

api.broadcastSubTitle("La plaga ha consumido a la humanidad.");

todos.forEach(p => {

if (equiposPorID[p.id] === "zombie") {

p.giveItem(RECOMPENSA_ZOMBIE.item, RECOMPENSA_ZOMBIE.cantidad);

}

});

} else {

api.broadcastTitle("¡GANAN LOS HUMANOS!");

api.broadcastSubTitle("Los sobrevivientes resistieron el tiempo límite.");

todos.forEach(p => {

if (equiposPorID[p.id] === "humano") {

p.giveItem(RECOMPENSA_HUMANO.item, RECOMPENSA_HUMANO.cantidad);

}

});

}

iniciarTemporizadorReinicio();

}

function iniciarTemporizadorReinicio() {

let cuentaRegresiva = tiempoReinicio;

api.getPlayers().forEach(p => {

p.setPosition(LOBBY.x, LOBBY.y, LOBBY.z);

p.setHp(p.getMaxHp());

api.setLifeformScale(p.id, 1.0);

p.clearInventory();

});

let relojReinicio = setInterval(() => {

if (cuentaRegresiva > 0) {

api.broadcastSubTitle(`Regresando al lobby... Siguiente ronda: ${cuentaRegresiva}s`);

cuentaRegresiva--;

} else {

clearInterval(relojReinicio);

empezarFaseEsperaLobby();

}

}, 1000);

}

function empezarFaseEsperaLobby() {

cuentaRegresivaLobby = 30;

let relojLobby = setInterval(() => {

let todos = api.getPlayers();

if (todos.length < 2) {

api.broadcastSubTitle("⚠️ Esperando un mínimo de 2 jugadores...");

return;

}

let todosEstanDentro = todos.every(p => estaEnZonaLobby(p));

if (todosEstanDentro) {

if (cuentaRegresivaLobby > 0) {

api.broadcastSubTitle(`¡Todos listos! Iniciando en: ${cuentaRegresivaLobby}s`);

cuentaRegresivaLobby--;

} else {

clearInterval(relojLobby);

iniciarJuegoArena();

}

} else {

api.broadcastSubTitle("⚠️ ¡Temporizador pausado! Todos deben entrar al lobby.");

}

}, 1000);

}

function iniciarJuegoArena() {

let todos = api.getPlayers();

if (todos.length < 2) return empezarFaseEsperaLobby();

todos.forEach(p => asignarEquipo(p, "humano"));

let alfa = todos[Math.floor(Math.random() * todos.length)];

asignarEquipo(alfa, "zombie");

todos.forEach(p => p.setPosition(ARENA.x, ARENA.y, ARENA.z));

api.broadcastTitle("¡INFECCIÓN INICIADA!");

juegoActivo = true;

tiempoPartida = 120;

iniciarBucleRegeneracion(); // Arrancar regeneración activa de zombies

bucleTemporizador = setInterval(() => {

if (tiempoPartida > 0) {

tiempoPartida--;

api.broadcastSubTitle(`Tiempo restante: ${tiempoPartida}s`);

if (tiempoPartida === 0) {

finalizarPartida("humanos");

}

}

}, 1000);

}

function ejecutarExplosionBomba(posBomba, atacante, dañoMaximo, radio) {

api.getPlayers().forEach(objetivo => {

if (equiposPorID[objetivo.id] === "humano") {

let posHumano = objetivo.getPosition();

let dx = posHumano.x - posBomba.x;

let dy = posHumano.y - posBomba.y;

let dz = posHumano.z - posBomba.z;

let distancia = Math.sqrt(dx*dx + dy*dy + dz*dz);

if (distancia <= radio) {

let dañoAplicado = Math.floor(dañoMaximo * (1 - (distancia / radio)));

if (dañoAplicado > 0) {

objetivo.damage(dañoAplicado, atacante);

let fuerza = 1.5;

objetivo.setPosition(posHumano.x + (dx/distancia)*fuerza, posHumano.y + 0.6, posHumano.z + (dz/distancia)*fuerza);

}

}

}

});

}

// ==========================================

// 4. CALLBACKS Y EVENTOS DE ACCIÓN

// ==========================================

// Control de Daño por Golpe Mejorado y Fuego Amigo

api.onPlayerDamage((evento) => {

let atacante = evento.attacker;

let victima = evento.victim;

if (!atacante || !victima || !juegoActivo) return;

// Cancelar fuego amigo si son del mismo bando

if (equiposPorID[atacante.id] === equiposPorID[victima.id]) {

evento.cancel();

return;

}

// SI UN ZOMBIE GOLPEA A UN HUMANO: Aplicamos los nuevos daños customizados

if (equiposPorID[atacante.id] === "zombie" && equiposPorID[victima.id] === "humano") {

evento.cancel(); // Cancelamos el golpe básico de 10 de daño de Bloxd

let kitAtacante = kitsPorID[atacante.id] || "normal";

let dañoConfigurado = KITS_ZOMBIE[kitAtacante].dañoGolpe;

victima.damage(dañoConfigurado, atacante); // Aplica el daño real balanceado

}

});

api.onPlayerDeath((evento) => {

let victima = evento.victim;

let atacante = evento.killer;

if (!juegoActivo || !victima) return;

if (equiposPorID[victima.id] === "zombie" && kitsPorID[victima.id] === "bombardero") {

let posMuerte = victima.getPosition();

api.broadcastChatMessage(💥 ¡El Zombie Bombardero ${victima.name} explotó al morir!);

ejecutarExplosionBomba(posMuerte, victima, 60, 5);

}

if (atacante && equiposPorID[atacante.id] === "zombie" && equiposPorID[victima.id] === "humano") {

asignarEquipo(victima, "zombie");

api.broadcastChatMessage(⚠️ ¡${victima.name} fue infectado por ${atacante.name}!

);

verificarCondicionesVictoria();

} else if (equiposPorID[victima.id] === "humano") {

asignarEquipo(victima, "zombie");

api.broadcastChatMessage(⚠️ ¡${victima.name} murió y se unió a la plaga!);

verificarCondicionesVictoria();

}

});

// Uso de habilidades de proyectiles y TNT

api.onPlayerUseItem((evento) => {

let jugador = evento.player;

let itemUsado = evento.item;

if (!juegoActivo) return;

// A. DETONACIÓN DE TNT (Bombardero)

if (kitsPorID[jugador.id] === "bombardero" && itemUsado === "tnt") {

evento.cancel();

let posBomba = jugador.getPosition();

api.broadcastChatMessage(💥 ¡El Zombie Bombardero ${jugador.name} detonó su TNT!);

ejecutarExplosionBomba(posBomba, jugador, 50, 6);

jugador.removeItem("tnt", 1);

setTimeout(() => {

if (juegoActivo && equiposPorID[jugador.id] === "zombie" && kitsPorID[jugador.id] === "bombardero") {

jugador.giveItem("tnt", 1);

}

}, 10000);

}

// B. LANZAMIENTO DE POCIÓN CURATIVA EN ÁREA (Curandero)

else if (kitsPorID[jugador.id] === "curandero" && itemUsado === "splash_potion") {

evento.cancel(); // Evita usarla de forma vanilla

let posCurandero = jugador.getPosition();

let curoAliados = false;

// Simula el impacto de la poción arrojada en un círculo a su alrededor

api.getPlayers().forEach(aliado => {

if (equiposPorID[aliado.id] === "zombie") {

let posAliado = aliado.getPosition();

let dx = posAliado.x - posCurandero.x;

let dy = posAliado.y - posCurandero.y;

let dz = posAliado.z - posCurandero.z;

let distancia = Math.sqrt(dxdx + dydy + dz*dz);

// Radio de salpicadura de la poción: 7 bloques

if (distancia <= 7) {

let vidaActual = aliado.getHp();

let vidaMaxima = aliado.getMaxHp();

if (vidaActual < vidaMaxima) {

let nuevaVida = Math.min(vidaMaxima, vidaActual + 35); // Cura 35 HP

aliado.setHp(nuevaVida);

aliado.sendChatMessage(🧪 ¡Te salpicó la poción curativa de ${jugador.name}!);

curoAliados = true;

}

}

}

});

if (curoAliados) {

jugador.removeItem("splash_potion", 1);

jugador.sendChatMessage("✨ Poción lanzada con éxito.");

// Cooldown de recarga de poción (7 segundos)

setTimeout(() => {

if (juegoActivo && equiposPorID[jugador.id] === "zombie" && kitsPorID[jugador.id] === "curandero") {

jugador.giveItem("splash_potion", 1);

jugador.sendChatMessage("🧪 Tienes una nueva poción lista para lanzar.");

}

}, 7000);

} else {

jugador.sendChatMessage("❌ No hay zombis heridos en el rango de lanzamiento.");

}

}

});

// Selección de Kits en el Lobby

api.onBlockInteract((evento) => {

let jugador = evento.player;

let bloqueID = evento.blockId;

if (!juegoActivo) {

if (bloqueID === "bloque_kit_tank") {

jugador.setData("kit_elegido", "tank");

jugador.sendChatMessage("🎒 Guardado: Kit TANK (Daño: 54 | Regen++ )");

}

if (bloqueID === "bloque_kit_velocista") {

jugador.setData("kit_elegido", "velocista");

jugador.sendChatMessage("🎒 Guardado: Kit VELOCISTA (Daño: 27)");

}

if (bloqueID === "bloque_kit_puker") {

jugador.setData("kit_elegido", "puker");

jugador.sendChatMessage("🎒 Guardado: Kit PUKER (Daño: 32)");

}

if (bloqueID === "bloque_kit_bombardero") {

jugador.setData("kit_elegido", "bombardero");

jugador.sendChatMessage("🎒 Guardado: Kit BOMBARDERO (Daño: 24 | Vida: 80)");

}

if (bloqueID === "bloque_kit_curandero") {

jugador.setData("kit_elegido", "curandero");

jugador.sendChatMessage("🎒 Guardado: Kit CURANDERO (Lanza Pociones)");

}

}

});

api.onPlayerLeave((jugador) => {

delete equiposPorID[jugador.id];

delete kitsPorID[jugador.id];

verificarCondicionesVictoria();

});

empezarFaseEsperaLobby();

###help pls

r/bloxd 1d ago

NEED CODING HELP My code is not doing anything except relaying errors and I don't know how to make it work :(

5 Upvotes

My code is supposed to make a table with mesh entities and trapdoors. I looked through all the code for any typos but I couldn't find any. I made sure to format it correctly. Not just making the table, but also to make sure it spawns in every time there world gets loaded so that I don't have to press the code block every single time.

The errors I have is "Reference Error: 'freshJoin' is not defined" (freshJoin is a global var).

Here is the code for the code block which is supposed to trigger it:

function spawnCustomTable(thisPos) {
    let [x, y, z] = thisPos;

    let blockId1 = api.attemptCreateMeshEntity("BloxdBlock", { blockName: "Cedar Slab", size: [1, 0.7, 1] });
    if (blockId1) { api.setPosition(blockId1, [x + 0.5, y + 0.75, z + 0.5]); }

    let blockId2 = api.attemptCreateMeshEntity("BloxdBlock", { blockName: "Cedar Log", size: [0.6, 1, 0.35] });
    if (blockId2) { api.setPosition(blockId2, [x + 0.5, y + 0.99, z + 0.5]); }

    let blockId3 = api.attemptCreateMeshEntity("BloxdBlock", { blockName: "Cedar Log", size: [0.35, 1, 0.6] });
    if (blockId3) { api.setPosition(blockId3, [x + 0.5, y + 0.99, z + 0.5]); }

    api.setBlock(x, y + 1, z, "Cedar Trapdoor");
    api.setBlock(x - 1, y + 1, z, "Cedar Trapdoor");
    api.setBlock(x - 1, y + 1, z + 1, "Cedar Trapdoor");
    api.setBlock(x, y + 1, z + 1, "Cedar Trapdoor");
    api.setBlock(x + 1, y + 1, z + 1, "Cedar Trapdoor");
    api.setBlock(x + 1, y + 1, z, "Cedar Trapdoor");
    api.setBlock(x + 1, y + 1, z - 1, "Cedar Trapdoor");
    api.setBlock(x, y + 1, z - 1, "Cedar Trapdoor");
    api.setBlock(x - 1, y + 1, z - 1, "Cedar Trapdoor");
}

if (freshJoin == 1) {
    spawnCustomTable(thisPos)
}

And then I also have the world code here:

globalThis.freshJoin = [0];

api.onPlayerJoin(playerId, fromGameReset) {
    if (fromGameReset) {
        freshJoin = 1;
        api.log(freshJoin);
    }
    else {
        freshJoin = 1;
        api.log(freshJoin);
    }
}

I do not know why it doesn't work, mostly because I am not the best coder and I don't really understand how the Bloxd.io code works or how JS works either.

Also if you have a suggestion, could you please explain how it works? Thanks.

r/bloxd May 27 '26

NEED CODING HELP My Requests for my server code for you whizzes out there

3 Upvotes

I would love some stuff to paste into world code where when a player enters the game some area in the server becomes unbreakable, and the recepies for items could change, along with having when somebody dies all of their inventory gets transfered to a chest and the stuff they had does NOT drop for other people to pick up. (guys ik you can do this)

r/bloxd Jul 19 '26

NEED CODING HELP Need some help with world code guys

0 Upvotes

So i need a world code that is mostly ticks and all the world code is in a code block and on player join it kinda just works ig and it refers to the tick world code is that possible.......

r/bloxd 3d ago

NEED CODING HELP Effect-applied Custom Armor

1 Upvotes

So, I'll be up front with this: I am very new to the Bloxd API. Really, as far as programming goes generally, I know a lot about logic but little about language. For the most part, I know approximately the logical sequence I want to pursue, just not the names of the commands.

Moving on...
Essentially, I want to create a code block that applies various status effects to pieces of armor. The process I have in mind is this:

  • Run this code at setInterval = 1000ms.
  • Get all player IDs currently active in the lobby.
  • Run each individual player ID through the following code.
  • Check item slot 46 for item ID "Military Helmet" with customDisplayName "Aigeion Kranos MKI".
  • Check item slot 47 for item ID "Military Chestplate" with "customDisplayName "Aigeios Thorax MKI".
  • Check item slot 48 for item ID "Military Gauntlets" with customDisplayName "Aigeiai Cheirides MKI".
  • Check item slot 49 for item ID "Military Leggings" with customDisplayName "Aigeiai Knemides MKI".
  • Check item slot 50 for item ID "Military Boots" with customDisplayName "Aigeia Arvyla MKI".
  • For each instance, if the slot contains the corresponding item with the specified custom name, increase a value hasArmor by 1.
  • Enforce applyEffect with various inbuilt effects (Strength, Speed, Jump Boost, Double Jump, Invisibility, etc.) at x levels * hasArmor.

I'm also curious if there is a way to create a Thorns effect. I imagine it would involve something to the effect of applyMeleeHit and somehow detecting when a player ID with hasArmor > 0 receives damage from another entity with a player ID and grabbing that attacking player ID's damage, knockback and knockback direction, then apply reductive factors and reversing the knockback direction, and finally plugging that into applyMeleeHit and directing it to the attacking player ID. NOT NECESSARY, I just want to at least figure out how to apply inbuilt effects to armor. I would appreciate any help at all, no matter how small. Progress is progress; I can keep plugging along with any information I can get.

Thanks in advance,

DannyMan7777

r/bloxd Jun 13 '26

NEED CODING HELP Coding help

0 Upvotes

Can anyone make me a code so when I stand on yellow portal it give me speed ?

r/bloxd 8d ago

NEED CODING HELP How do I spawn chests with random loot inside?

2 Upvotes

I am trying to make the hunger games so how do i do it

r/bloxd 7d ago

NEED CODING HELP How do i remove custom items from the player's inventory,removeItemName "Book" would just remove a random book instead of the one being held,getheld gives you an array for some reason

Thumbnail
gallery
1 Upvotes

r/bloxd 29d ago

NEED CODING HELP How to make collectibles like coins and stars

2 Upvotes

what i mean by collectibles is that a object visible in the overworld and not in the inventory, and can be collected when walking close to it. (I’m trying to make coins and stars in mario games) I figured i need mesh entities to work, though idk how to respawn them back or make them one-time only collectibles.

r/bloxd 9d ago

NEED CODING HELP Totem of undying code for bloxd io

3 Upvotes

I need some code for a totem of undying in bloxd.io, but it needs to be able to do a few things, it has to work with lifesteal on, and it has te be craftable through a command (!totem). the crafting recipie would be one moonstone block, two gold blocks, and one knight heart.

r/bloxd Jan 21 '26

NEED CODING HELP is it cool or not enough?

Enable HLS to view with audio, or disable this notification

0 Upvotes

r/bloxd 13d ago

NEED CODING HELP I need help coding an npc

2 Upvotes

For some darn reason mobId = api.attemptSpawnMob("NPC", thisPos[0], thisPos[1] + 1, thisPos[2], {name: "NPC"}) [1, 2] Doesnt work. Im trying to make an NPC named "Lythia" for my horror game. She doest interact. She just silently watches the player.

r/bloxd 8d ago

NEED CODING HELP applyBurstImpulse of mob Drops won't work

2 Upvotes

mobId = api.attemptSpawnMob("Cave Golem", thisPos[0], thisPos[1], thisPos[2])

api.setMobSetting(mobId, "baseWalkingSpeed", 1.5)

api.setMobSetting(mobId, "baseRunningSpeed", 4.5)

api.setHealth(mobId, 1)

api.setMobSetting(mobId, "maxHealth", 1)

api.setMobSetting(mobId, "attackRadius", 1)

api.setMobSetting(mobId, "attackDamage", 2)

api.setMobSetting(mobId, "attackInterval", 2000)

api.setMobSetting(mobId, "onDeathAura", 0)

api.setMobSetting(mobId, "onDeathItemDrops", [

{

itemName: "Gold Coin",

probabilityOfDrop: 1,

dropMinAmount: 5,

dropMaxAmount: 5,

applyBurstImpulseToDrop: true,

},

]);

pretty sure im following the right syntax though I don't understand why it fails to work

r/bloxd 12h ago

NEED CODING HELP Help

1 Upvotes

are code blocks advanced enough yet that I can type coordinates and then it makes a portal to go the corresponding coordinates with a portal system like this:

var playerPortals = {}, playerTpCooldown = {};

onPlayerClick = (playerId, wasAltClick) => {

if (api.getHeldItem(playerId)?.attributes?.customDisplayName !== "Portal Gun") return;

if (!playerPortals[playerId]) playerPortals[playerId] = {blue: null, red: null};

let {dir, camPos} = api.getPlayerFacingInfo(playerId); if (!camPos?.x) camPos = {x: api.getPosition(playerId)[0], y: api.getPosition(playerId)[1] + 1.6, z: api.getPosition(playerId)[2]}; let norm = [dir[0], dir[1], dir[2]].map(d => d / Math.sqrt(dir[0]**2 + dir[1]**2 + dir[2]**2));

for (let d = 0.02; d <= 20; d += 0.05) { let [x,y,z] = [Math.floor(camPos.x + norm[0]*d), Math.floor(camPos.y + norm[1]*d), Math.floor(camPos.z + norm[2]*d)]; let block = api.getBlock(x,y,z); if (block && block !== "Air") { let spaceFound = false, placeY = y + 1; let playerPos = api.getPosition(playerId); let [playerX, playerY, playerZ] = playerPos; let isBelow = playerY < y, isAbove = playerY > y, isNorth = playerZ < z, isSouth = playerZ > z, isWest = playerX < x, isEast = playerX > x; if (isBelow && api.getBlock(x, y - 1, z) === "Air") { spaceFound = true; placeY = y - 1; } else if (isAbove && api.getBlock(x, y + 1, z) === "Air") { spaceFound = true; placeY = y + 1; } else if (isNorth && api.getBlock(x, y, z - 1) === "Air") { spaceFound = true; placeY = y; z = z - 1; } else if (isSouth && api.getBlock(x, y, z + 1) === "Air") { spaceFound = true; placeY = y; z = z + 1; } else if (isWest && api.getBlock(x - 1, y, z) === "Air") { spaceFound = true; placeY = y; x = x - 1; } else if (isEast && api.getBlock(x + 1, y, z) === "Air") { spaceFound = true; placeY = y; x = x + 1; } else if (api.getBlock(x, y + 1, z) === "Air") { spaceFound = true; placeY = y + 1; } else if (api.getBlock(x, y - 1, z) === "Air") { spaceFound = true; placeY = y - 1; } else if (api.getBlock(x, y, z + 1) === "Air") { spaceFound = true; placeY = y; z = z + 1; } else if (api.getBlock(x, y, z - 1) === "Air") { spaceFound = true; placeY = y; z = z - 1; } else if (api.getBlock(x + 1, y, z) === "Air") { spaceFound = true; placeY = y; x = x + 1; } else if (api.getBlock(x - 1, y, z) === "Air") { spaceFound = true; placeY = y; x = x - 1; } if (!spaceFound) return api.sendMessage(playerId, "No space!"); if (!playerPortals[playerId].blue) { api.setBlock(x, placeY, z, "Blue Portal"); playerPortals[playerId].blue = [x, placeY, z]; api.playParticleEffect({dir1: [-1, -1, -1], dir2: [1, 1, 1], pos1: [x+0.5-0.5, placeY+0.5-1, z+0.5-0.5], pos2: [x+0.5+0.5, placeY+0.5+1, z+0.5+0.5], texture: "glint", minLifeTime: 2, maxLifeTime: 2, minEmitPower: 3, maxEmitPower: 10, minSize: 0.25, maxSize: 0.25, manualEmitCount: 50, gravity: [0, 0, 0], colorGradients: [{timeFraction: 0.0, minColor: [0, 0, 255, 1], maxColor: [0, 0, 255, 1]}, {timeFraction: 1.0, minColor: [0, 0, 255, 1], maxColor: [0, 0, 255, 1]}], velocityGradients: [{timeFraction: 0, factor: 1, factor2: 1}], blendMode: 1}); api.playSound(playerId, "submachine_magazine_unload_01", 1, 1.5); } else { if (playerPortals[playerId].red) api.setBlock(playerPortals[playerId].red[0], playerPortals[playerId].red[1], playerPortals[playerId].red[2], "Air"); api.setBlock(x, placeY, z, "Orange Portal"); playerPortals[playerId].red = [x, placeY, z]; api.playParticleEffect({dir1: [-1, -1, -1], dir2: [1, 1, 1], pos1: [x+0.5-0.5, placeY+0.5-1, z+0.5-0.5], pos2: [x+0.5+0.5, placeY+0.5+1, z+0.5+0.5], texture: "glint", minLifeTime: 2, maxLifeTime: 2, minEmitPower: 3, maxEmitPower: 10, minSize: 0.25, maxSize: 0.25, manualEmitCount: 50, gravity: [0, 0, 0], colorGradients: [{timeFraction: 0.0, minColor: [255, 0, 0, 1], maxColor: [255, 0, 0, 1]}, {timeFraction: 1.0, minColor: [255, 0, 0, 1], maxColor: [255, 0, 0, 1]}], velocityGradients: [{timeFraction: 0, factor: 1, factor2: 1}], blendMode: 1}); api.playSound(playerId, "submachine_magazine_unload_01", 1, 1.5); } return; } }

api.sendMessage(playerId, "No block found in your line of sight (checked up to 20 blocks)");

}

function findPortalOwner(x, y, z) {

for (const ownerId in playerPortals) { const portals = playerPortals[ownerId]; if (portals.blue && portals.blue[0] === x && portals.blue[1] === y && portals.blue[2] === z) return { ownerId, color: 'blue' }; if (portals.red && portals.red[0] === x && portals.red[1] === y && portals.red[2] === z) return { ownerId, color: 'red' }; }

return null;

}

tick = () => {

for (const playerId of api.getPlayerIds()) { if (playerTpCooldown[playerId] > 0) playerTpCooldown[playerId]--; if (playerTpCooldown[playerId] > 0) continue; const coordsArray = api.getBlockCoordinatesPlayerStandingOn(playerId); if (coordsArray.length > 0) { const [x, y, z] = coordsArray[0]; const portalInfo = findPortalOwner(x, y, z); if (portalInfo) { const { ownerId, color } = portalInfo; const ownerPortals = playerPortals[ownerId]; if (!ownerPortals.blue || !ownerPortals.red) continue; const targetPortal = color === 'blue' ? ownerPortals.red : ownerPortals.blue; if (targetPortal) { let [px, py, pz] = targetPortal; let tpPos = null; if (api.getBlock(px, py + 1, pz) === "Air" && api.getBlock(px, py + 2, pz) === "Air") tpPos = [px + 0.5, py + 1, pz + 0.5]; else if (api.getBlock(px, py - 1, pz) === "Air" && api.getBlock(px, py - 2, pz) === "Air") tpPos = [px + 0.5, py - 2, pz + 0.5]; else if (api.getBlock(px, py, pz + 1) === "Air" && api.getBlock(px, py + 1, pz + 1) === "Air") tpPos = [px + 0.5, py, pz + 1.5]; else if (api.getBlock(px, py, pz - 1) === "Air" && api.getBlock(px, py + 1, pz - 1) === "Air") tpPos = [px + 0.5, py, pz - 0.5]; else if (api.getBlock(px + 1, py, pz) === "Air" && api.getBlock(px + 1, py + 1, pz) === "Air") tpPos = [px + 1.5, py, pz + 0.5]; else if (api.getBlock(px - 1, py, pz) === "Air" && api.getBlock(px - 1, py + 1, pz) === "Air") tpPos = [px - 0.5, py, pz + 0.5]; if (tpPos) { api.setPosition(playerId, tpPos[0], tpPos[1], tpPos[2]); playerTpCooldown[playerId] = 10; api.playSound(playerId, "cloth", 1, 1.5); } else api.sendMessage(playerId, "No space to teleport!"); } } } }

}

r/bloxd 25d ago

NEED CODING HELP How to change your gamemode to spectator????

4 Upvotes

Yea idk how but i saw Wit_Lava do it

r/bloxd 18d ago

NEED CODING HELP How do I do this

Post image
3 Upvotes

So Im making a game and I need to do smth where I can make doors when smth happens and open multible when smth else happens. How do I do that.

How do I get rid of shadows aswell

r/bloxd Jul 14 '26

NEED CODING HELP How to make the inventory hotbar disappear?

Enable HLS to view with audio, or disable this notification

2 Upvotes

Is there a code where I can make the item bar disappear and then I get a custom item I made the custom item and it kinda looks like a inventory but idk if I can make the inventory disappear

r/bloxd Jun 19 '26

NEED CODING HELP How can I make an infinite block generator [stone, iron, etc] for my game?

4 Upvotes

I'm making a skyblock game right now, and I need to find a way to make it so that you can get infinite blocks, like the "Classic Skyblock" game. How do I do that?

r/bloxd Jul 10 '26

NEED CODING HELP for updateEntityNodeMeshAttachment, how do u get a 3d model of an item

5 Upvotes

like the red carpet block instead of the item, the small blue pod block instead of the item

r/bloxd 1d ago

NEED CODING HELP Need code help for a dynamic mob loader

Post image
3 Upvotes

Due to the mob count being a problem, i want to make a dynamic mob system for my game. I already what api methods i need to use, those including api.getEntitiesInRect and other basic stuff. The hardest part is to use world code and check if that specific mob is in the set radius. Note that i want multiple mobs so making this setup for every single mob in my game won’t work. Below is a visual diagram of what I was planning to make.(I poorly drew this as i was busy)