Need Help for saving props

Hello guys,

I couldnt really find a helpfull post about my question so i was gonna give it a try if someone could help me out real quick on my issue or like my problem.

lets say in my Prison, the stairs are opened up and the people can just easily walk outside, now i want to add some cages oder something blocking infront of them.

Whats the best way to spawn those props and even more important how to save them to the server, so i dont need to add them everytime i restart the server again?

I hope someone can help me out and Im already really thankful for everyone who takes the time to read it and to help.

Thanks guys :slight_smile:

Spawn in the props when the clients are close :slight_smile:

Wrote this code up quick on my school laptop hehe so its not tested but with this idea, it despawns the object when you are far away and spawns when you are close to it. This does not ‘save’ anything to the server as that is not needed it just handles it all locally on the client.

CreateThread(function()
    local object = `your_object_name`
    local coords = vec(x, y, z)
    local handle = nil

    while true do Wait(500)
        if #(GetEntityCoords(PlayerPedId()) - coords) < 50 then
            if not DoesEntityExist(object) then
                object = CreateObject(.....)
            end
        else
            if DoesEntityExist(object) then DeleteEntity(object) end
        end
    end
end)