[HELP] DLC props not loading in when created in script

So my problem is that some objects are not spawning, in this case: bkr_prop_weed_lrg_01b

But my code works on other base game objects so the code is probably not the problem.

My question is, is there any way to spawn those objects within a script? (I’m not looking to make a map)

Which gamebuild version do you use?

Try to use the latest one and see if the issue persists. Also mind updating your server artifact.
But I’m not sure if this will fix your issue. Just try it and go later on if it’s still not working.

Lets start with, are you trying to spawn these things in a server file or a client file? The server should eventually always spawn the entity, so long as a valid model is passed, the server can take some time to do this though, and so you may need to wait for the entity to exist. If you are trying to have a client spawn an entity, you need to make sure you are requesting the model and waiting for it to load fully.
while not HasModelLoaded(model) do RequestModel(model); Wait(10); end
If you are attempting to spawn these client side and you are not requesting the models currently, the reason some stuff spawns and other stuff doesn’t is that the models that spawned are already loaded into memory and can spawn.

I use “2944 #mp2023_01 - San Andreas Mercenaries”

And to be honest I’m rather new to fivem development so I don’t really know what it does, i just left it on deafult.

I spawn them on the client side and I request the model of the objects before spawning them.

Here is a snippet.

And now I use a similar but not perfect object combination (small plant in pot and marijuana without pot on top) to simulate the desired object (marijuana in pot) but it would be better overall to use the one thats in the dlc.

– Call the function to spawn marijuana cultivations
if not HasModelLoaded(modelHash) then
– If the model isnt loaded we request the loading of the model and wait that the model is loaded
RequestModel(modelHash)

while not HasModelLoaded(modelHash) do
    Citizen.Wait(1)
    print("model loading")
end

end

if not HasModelLoaded(modelHashPot) then
– If the model isnt loaded we request the loading of the model and wait that the model is loaded
RequestModel(modelHashPot)

while not HasModelLoaded(modelHashPot) do
    Citizen.Wait(1)
    print("model loading")
end

end

print(“models loaded”)
SpawnMarijuanaCultivations()

Does the system print infinitely when it fails to spawn the prop? Like, your “model loading” print, does that go forever when you use the DLC props and they don’t spawn?

Long story short, I believe you need to stream the DLC props so they are consistently in client memory to be loadable. I don’t really know how to explain what I’m about to try to BUT, it seems like some default GTA props are only loadable into memory when you are in specific parts of the map or something, maybe? I can’t recall exactly what I dealt with that made me conclude you have to stream them, but there was some instance of a prop that wouldn’t spawn in certain parts of the map, and streaming it fixed it.