Working on a client resource that creates some local props for interaction points. During development when I restart the resource repeatedly, each restart leaves another prop at the same coordinates. Reconnecting clears all the duplicates for that client.
I'm tracking all the created handles in a table already - just need to hook up cleanup. What's the proper way to handle resource stop cleanup for locally created entities? I assume there's an event I should be catching to clean these up before the resource fully stops.
VortexGamer · 26/08/2026
Yep, you can handle this with the onResourceStop event on the client side. Since you're already storing the created entity handles in a table, just loop through them and delete each entity when the resource stops.
AddEventHandler('onResourceStop', function(resourceName)
if GetCurrentResourceName() ~= resourceName then return end
for _, entity in pairs(createdProps) do
if DoesEntityExist(entity) then
DeleteEntity(entity)
end
end
createdProps = {}
end)This should clean up all locally created props whenever the resource is stopped or restarted, so they won't keep stacking during development.
Max · 26/08/2026
Sign in to reply.