Deleting entities can be difficult for some people, especially with the change of network owners. Using this code snippet will allow you to delete entities from the server. That means reliability!
client.lua
1
2
3
function DeleteEntity(Entity)
TriggerServerEvent("PendingDevelopment:DeleteEntity", NetworkGetNetworkIdFromEntity(Entity))
end
server.lua
1
2
3
4
RegisterNetEvent("PendingDevelopment:DeleteEntity")
AddEventHandler("PendingDevelopment:DeleteEntity", function(NetworkID)
DeleteEntity(NetworkGetEntityFromNetworkId(NetworkID))
end)
References
RegisterNetEvent
AddEventHandler
NetworkGetNetworkIdFromEntity
NetworkGetEntityFromNetworkId
DeleteEntity