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

Why wont my script clone the folder into the leaderstats folder?

local me = script.Parent.Z1
local EXP = script.Parent.EXP
local Gold = script.Parent.Gold
local plr = game.Players.LocalPlayer
local lstats = plr:WaitForChild("leaderstats")

game.Players.PlayerAdded:Connect(function(Player)
	local ree = me:Clone()
	ree.Parent = lstats
end)

My script is supposed to clone a folder with scripts inside of it, and it wont work for some reason. I check inside of the player, and it doesn't show, or even run the scripts. If you know what's wrong, please tell me! Thanks.

2 answers

✓ Accepted answer

just extract the folder you have into StarterPlayer\StarterPlayersScripts

2 comments

0

I tried that, it didnt work. Whats extracting, though? Because i want it cloned for everyone, is it the same thing?

0

Extracting is just a fancy way of saying, "Put" or "Place", for example, extract the folder into StarterPlayer, he's saying put the folder into starter player.

Put your ServerScript that's handling the cloning into ServerScriptService, and then put the Folder inside of ReplicatedStorage and call it from there.

ServerScript

game.Players.PlayerAdded:Connect(function(player)
	local me = game:GetService("ReplicatedStorage"):WaitForChild("Z1"):Clone()
	local EXP = game:GetService("ReplicatedStorage"):WaitForChild("EXP"):Clone()
	local Gold = game:GetService("ReplicatedStorage"):WaitForChild("Gold"):Clone()

	me.Parent = player:WaitForChild("leaderstats")
	EXP.Parent= player:WaitForChild("leaderstats")
	Gold.Parent = player:WaitForChild("leaderstats")
end)

All you have to do is put a Folder inside of ReplicatedStorage with all the scripts, and then put a ServerScript inside of ServerScriptService and write the code above.

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