ClientReplicate
The client-side representation of a Replicate. This is the object that you interact with when using Replicates on the client.
Summary
Properties
| Data : Variant |
Methods
| GetValue (path: ValuePath) : Variant |
| GetValueChangedSignal (path: ValuePath) : Signal |
| GetArrayModifiedSignal (path: ValuePath) : Variant |
Properties
Data
Read Only
ClientReplicate.Data ( ) : Variant
local clientReplicate = Replicate:GetReplicate()
local money: number = clientReplicate.Data.money
print("Player has:", money, "dollars!")
Methods
GetValue
ClientReplicate:GetValue ( path: ValuePath ) : Variant
Parameters
| path : ValuePath |
Returns
| Variant |
local ValuePath = Replicate.Utility.ValuePath
local clientReplicate = Replicate.Client:GetReplicate()
local money: number = clientReplicate:GetValue(ValuePath("money"))
print("Player has:", money, "dollars!")
GetValueChangedSignal
ClientReplicate:GetValueChangedSignal ( path: ValuePath ) : Signal
Parameters
| path : ValuePath |
Returns
| Signal |
GetArrayModifiedSignal
ClientReplicate:GetArrayModifiedSignal ( path: ValuePath ) : Variant
Parameters
| path : ValuePath |
Returns
| Variant |
local ValuePath = Replicate.Utility.ValuePath
local clientReplicate = Replicate.Client:GetReplicate()
local path = ValuePath("fruit.berries")
local function onInserted(index: number, value: any): nil
print("Value:", value, "inserted at index:", index)
return nil
end
local function onRemoved(index: number, value: any): nil
print("Value:", value, "removed at index:", index)
return nil
end
clientReplicate:GetArrayModifiedSignal(path):Removed():Connect(onRemoved)
clientReplicate:GetArrayModifiedSignal(path):Inserted():Connect(onInserted)
-- you could also do this:
local arrayModifiedSignal = clientReplicate:GetArrayModifiedSignal(path)
arrayModifiedSignal:Removed():Connect(onRemoved)
arrayModifiedSignal:Inserted():Connect(onInserted)