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

Why won't this local script get cloned inside a character?

Everything works without errors but the localscript won't get cloned inside the character,why?

game.Players.PlayerAdded:connect(function(Player)
	Character = Player.Character
	print(Character.Name)
	for Number,LocalScripts in pairs (script:GetChildren()) do
		LocalScripts:Clone().Parent = Character
		LocalScripts.Disabled = false
		print(Player.Name,"now has",LocalScripts)
	end

end)

1 answer

✓ Accepted answer

Player:WaitForChild(Character)

When a player is added, the character,isn't loaded yet, so adding that line will make the function wait until the character exists then it will execute everything below it in the function.

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