Here's the code.

local gameData = game:GetService("DataStoreService"):GetDataStore("G")
local codeData = game:GetService("DataStoreService"):GetDataStore("C")

game.Players.PlayerAdded:Connect(function(p)
	local Data_Packet = game.ServerStorage.Data_Packet
	--
	local playerName = Instance.new("Folder", Data_Packet)
	playerName.Name = p.Name
	--
	local currencyFolder = Instance.new("Folder", playerName)
	currencyFolder.Name = "Currency_Folder"
	
	local pixelCurrency = Instance.new("IntValue", currencyFolder)
	pixelCurrency.Name = "Pixel_Currency"
	pixelCurrency.Value = 0
	
	local gemCurrency = Instance.new("IntValue", currencyFolder)
	gemCurrency.Name = "Gem_Currency"
	gemCurrency.Value = 0
	--
	local skinsFolder = Instance.new("Folder", playerName)
	skinsFolder.Name = "Skins_Folder"
	--
	local skin1 = Instance.new("BoolValue", skinsFolder)
	skin1.Name = "OrangeSkin"
	skin1.Value = false
	local skin2 = Instance.new("BoolValue", skinsFolder)
	skin2.Name = "PurpleSkin"
	skin2.Value = false
	local skin3 = Instance.new("BoolValue", skinsFolder)
	skin3.Name = "GreenSkin"
	skin3.Value = true
	--
	local Invites = Instance.new("IntValue", playerName)
	Invites.Name = "Invites"
	Invites.Value = 0
	--
	local dataList = {}

for _, data in pairs(Data_Packet:GetDescendants()) do
    -- just make this into a key value pair so we dont need to loop to find each tool
    dataList[data.Name], dataList[data.Name].Value = data -- tools must have different names else it will be overwritten
end
	--
	
	 local id = 'gameData_' .. tostring(p.UserId)
	
	local savedGameData = gameData:GetAsync(id)
	
	if savedGameData then
		for ii, vv in pairs(savedGameData) do
			vv.Value = savedGameData
		end
	end
	--
	local codesFolder = Instance.new("Folder", playerName)
	codesFolder.Name = "Codes_Folder"
	local codeOne = Instance.new("BoolValue", codesFolder)
	codeOne.Name = "CodeOne"
	codeOne.Value = false
	--
	
	--
	p.CharacterAdded:Connect(function()
		wait()
		game.ServerStorage.Main_Holder:Clone().Parent = p.PlayerGui
	end)
end)


game.Players.PlayerRemoving:Connect(function(plr)
	
end)

1 comment

0

You have to have an explaination no can fix your problem if you don't tell us what it is