Skip to main content

AccessDataServiceInterface

The tie for AccessDataService, so other packages can ask about access without depending on this one.

A package like an area-gating library should not have to require the access package -- and should not break in a game that has no access package at all. It reaches the implementation through this definition instead, and simply finds nothing when access is not installed.

local accessDataService = AccessDataServiceInterface:Find(ReplicatedStorage)
if accessDataService then
	accessDataService:ObserveIsFeatureAllowedByName(player, "chapters"):Subscribe(...)
end

Why the members are name-based

A consumer that already holds an AccessFeature object also holds this package, so it does not need a tie. The methods worth exposing here are the ones addressable by string, which is what a decoupled consumer actually has -- the same names the console autocompletes.

Why overriding is server-only here

Setting a fact is granting an entitlement. Putting the setters behind TieDefinition.Realms.SERVER means a client-side consumer cannot even see them, so the rule is enforced by the interface rather than by a comment asking people to behave.

Show raw api
{
    "functions": [],
    "properties": [],
    "types": [],
    "name": "AccessDataServiceInterface",
    "desc": "The tie for [AccessDataService], so other packages can ask about access without depending on this one.\n\nA package like an area-gating library should not have to `require` the access package -- and should\nnot break in a game that has no access package at all. It reaches the implementation through this\ndefinition instead, and simply finds nothing when access is not installed.\n\n```lua\nlocal accessDataService = AccessDataServiceInterface:Find(ReplicatedStorage)\nif accessDataService then\n\taccessDataService:ObserveIsFeatureAllowedByName(player, \"chapters\"):Subscribe(...)\nend\n```\n\n## Why the members are name-based\n\nA consumer that already holds an [AccessFeature] object also holds this package, so it does not need a\ntie. The methods worth exposing here are the ones addressable by **string**, which is what a decoupled\nconsumer actually has -- the same names the console autocompletes.\n\n## Why overriding is server-only here\n\nSetting a fact is granting an entitlement. Putting the setters behind\n[TieDefinition.Realms].SERVER means a client-side consumer cannot even see them, so the rule is\nenforced by the interface rather than by a comment asking people to behave.",
    "source": {
        "line": 30,
        "path": "src/access/src/Shared/AccessDataServiceInterface.lua"
    }
}