M MY Multiplayer: Wiki
Side
Kind

onResourceStop

ServerEvent

Fired when a resource is about to stop, while its scripts and elements still exist.

addEventHandler("onResourceStop", root, function(resource stoppedResource) … end)

Handler parameters

NameTypeDescription
stoppedResourceresourceThe resource about to stop.

Source

The element of the resource about to stop.

With a handler on resourceRoot, only the resource itself; with one on root, every resource.

Example

addEventHandler("onResourceStop", resourceRoot, function(stoppedResource)
    for _, player in ipairs(getPlayers()) do
        setElementData(player, "score", nil)
    end
end)

See also