Yes i know making the folder is the easiest part but for some reason its not working. Hope someone can help.

local dss = game.GetService("DataStoreService")
local ds1 = dss:GetDataStore("Cash")
local ds2 = dss:GetDataStore("Fruits")

game.Players.PlayerAdded:Connect(function(plr)
	local fdr = Instance.new("Folder", plr)
	fdr.Name = "leaderstats"
	fdr.Parent = plr
	
	local cash = Instance.new("IntValue", fdr)
	cash.Name = "Coins"
	
	local fruits = Instance.new("IntValue", fdr)
	fruits.Name = "Fruits"
	
	cash.Value = ds1:GetAsync(plr.UserId) or 0
	ds1:SetAsync(plr.UserId, cash.Value)
	
	fruits.Value = ds2:GetAsync(plr.UserId) or 0
	ds2:SetAsync(plr.UserId, fruits.Value)
	
	cash.Changed:Connect(function()
		ds1:SetAsync(plr.UserId, cash.Value)
	end)
	
	fruits.Changed:Connect(function()
		ds2:SetAsync(plr.UserId, fruits.Value)
	end)
end)

5 comments

0

PlayerAdded isn't firing?

0

Where is the script located and what type of script is it?

0

A saving script and it is located in serverscript service

0

have you checked to make sure it's not creating the folder somewhere else

0

yea i have