FIVEM : Uncaught TypeError: Cannot read property 'x' of undefined (@esx_mcdonaldscrafting/html/js/app.js:66)

1.3k views Asked by At

So I'm trying to develop a fivem server without knowing much about coding. I get this error in a script I have and at row 66 I have this :

return { 'x': rects.x + (rects.width/2),'y': rects.y + (rects.height/2) };

Full :

// Get the abosolute position of a node

function getPosition(node) {

var rects = node.getClientRects()[0];

return { 'x': rects.x + (rects.width/2),'y': rects.y + (rects.height/2) }; }


Anyone who can help me out?

Note: This is a dublicated script (the script is officially named esx_crafting) which I wanted to seperate from the original one. It is used to craft items using what you have in your inventory but I wanted to make different list items depended on the x,y,z of each crafting menu. So that's the reason why I dublicated the scripts. If that's the problem, is there any other way to make this work?

0

There are 0 answers