replica.Actions: A

Server Only

A table of directly-callable, fully typed functions built from ReplicaParams.Actions. Preferred way to call an Action when its name is known at write-time: arguments are type-checked and autocompleted.

Returns

AThe typed Actions table declared for this Replica.
-- > // PlayerDataActions.luau
local PlayerDataActions = {}
 
function PlayerDataActions.BuyItem(replica, item_id: string, price: number)
    replica:SetValue({"Gold"}, replica.Data.Gold - price)
    replica:ArrayInsert({"Inventory"}, item_id)
end
 
return PlayerDataActions
 
-- > // elsewhere
replica.Actions.BuyItem("Sword", 50)