#Replica

1 messages · Page 1 of 1 (latest)

elfin spindle
#

why child replica is not deleted

CLIENT:

Replica.OnNew("child",function(replica)
    replica.Maid:Add(function()
        print("deleted")
    end)
end)

SERVER:

local ParentReplica = Replica.New({
    Token = Replica.Token("ez");
    Data = {}
})
ParentReplica:Replicate()

local ChildReplica = Replica.New({
    Token = Replica.Token("child");
    Data = {}
})

ChildReplica:SetParent(ParentReplica)

task.delay(5,function()
    ParentReplica:Destroy()
end)
#

it doesnt print

potent plume
#

why are you using replica

elfin spindle
potent plume
potent plume
#

well that depends why are you using replica?

elfin spindle
#

for hide and seek game

potent plume
#

maybe remote events?

#

or something

#

idk, you don't need replica for a simple game like that

#
#

as a beginner you're literally just making things harder for yourself

#

i mean your choice if you want to do that, just as much as if you want to eat cat food and jump off a bridge i mean i'd like it if you didn't do those things but if you're going to do that to yourself there isn't anything i can really do to stop you, y'know?

elfin spindle
potent plume
#

90% of questions asked here are by beginners so it's usually a fairly safe bet, and you have close to a hello world use-case of replica here which is consistent with that

potent plume
# potent plume why are you using replica

this still stands though, you have a basic use-case which isn't working for you, and you don't seem to have a strong reason for needing replica other than just bcoz. more code is technical debt, more places for things to go wrong.

potent plume
elfin spindle
#

also i fixed my issue

#

CLIENT:

```lua

Replica.OnNew("child",function(replica)
replica.Maid:Add(function()
print("deleted")
end)
end)


    **SERVER**:

    ```lua
local ParentReplica = Replica.New({
    Token = Replica.Token("ez");
    Data = {}
})
ParentReplica:Replicate()

local ChildReplica = Replica.New({
    Token = Replica.Token("child");
    Data = {}
})
ChildReplica:Replicate()
ParentReplica.Maid:Add(ChildReplica)

task.delay(5,function()
    ParentReplica:Destroy()
end)
#

heres the fix

#

idk why theres setparent if it doesnt work properly

potent plume
#

i've checked the replica source code and it does raise maid cleanup on all the child replicas on the client when you destroy the parent

elfin spindle
#

on client in doesnt

#

for childrne

potent plume
elfin spindle
#

oh

#

idk

#

but it doesnt work anyway

potent plume
#

technical debt ;p

elfin spindle
#

what

elfin spindle
potent plume
#

i'd have to get in there and test it in studio but i dont have access to studio right now

#

definitely seems like the child is not being sent