rebar-altv
rebar-altv copied to clipboard
Rebar.usePlayer(player).attachment.remove not work
Rebar.usePlayer(player).attachment.remove
not work
i think i found why
function createAttachments has not push the new object to entityAttachments[]
async function createAttachments(player: alt.Player, attachments: Attachment[]) { entityAttachments[player.id] = [];
for (let attachment of attachments) {
if (!attachment.rot) {
attachment.rot = alt.Vector3.zero;
}
const object = new alt.LocalObject(
attachment.model,
player.pos,
new alt.Vector3(attachment.rot),
true,
false,
true,
15,
);
await object.waitForSpawn();
object.attachToEntity(
player,
attachment.bone,
new alt.Vector3(attachment.offset),
new alt.Vector3(attachment.rot),
true,
false,
true,
);
//add this
entityAttachments[player.id].push(object);
}
}