Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I know if a child was added? [Easy problem]

I have this script:

local player = script.Parent.Parent
repeat wait() until player.Character
game.Players.LocalPlayer.Character:WaitForChild("PlayerSkins").ChildAdded:connect(function(skin)
	print("Auto saving...")
	local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")--Player key
local statstorage = player.Character:WaitForChild("PlayerSkins"):GetChildren()
for i = 1, #statstorage do
	datastore:SetAsync(statstorage[i].Name, statstorage[i].Value)
	print(statstorage[i].Value.." Saved succesfully!")
	wait(.1)
end
print("Succesfully saved!")
end)


I want to test it but it won't do anything when a child is added.. Information: Script is a NORMAL SCRIPT Script is in STARTER PLAYER SCRIPTS

I tried: DescendentAdded ChildAdded And none worked.. How do I make it work???

1 answer

It needs to be a local script in game.StarterPlayer.StarterPlayerScripts

3 comments

0

if you're gonna be so short why won't you use comments?

0

I can't access datastore from a local script só there needs to be other way

0

there isn't a way without RemoteEvents and RemoteFunctions

This discussion is preserved as it was. New answers, comments, and votes are closed.