Repeat an event inside the player added

is there a way to do this so i dont have to worry about it

i dont want to use while loops

can answers be like coroutines and spawn and delay

Could you elaborate on what specifically you want to do? This question is particularly very broad.

1 Like

basically when the player is added a folder is added and a child added event just runs once so how can i repeat child added in a player adding event?

Then just attach a ChildAdded event in the folder??? That event fires if a child is added to a instance.

you mean insert a script inside the folder i wouldnt or what are you talking about

game.Players.PlayerAdded:Connect(function(plr)
    local folder = Instance.new("Folder")
    folder.Parent = plr
    plr.ChildAdded:Connect(function(child)
        --stuff
    end)
end)

shouldnt it be the folder that im referencing

You said a folder is created when a player joins, meaning you either used Instance.new or cloned a folder. Either will do, just attach an event to it.

so i put the child added event of the folder inside the player.ChildAdded event?

What are you trying to do with the ChildAdded event?

save the players data by using datastore2

Why do you need to attach a ChildAdded event when saving a player’s data?

because datastore2 saves without even using a player added event

it doesnt even print saved when a child is added

When saving data, it should be done in some ways:

  1. Auto save.
  2. Player leaving
  3. Game shutting down

The ChildAdded won’t let you save data.

well im using datastore2 so i dont need any of that

You may look at a post on how to properly save data using Datastore2:

Instead im going to use it in remote events so no one gets confused