-- Main --


Players.PlayerAdded:Connect(function(plr)
	local DonatedStore = Datastore2("Donated", plr) 
	local RaisedStore = Datastore2("Raised", plr)

	local Leaderstats = Instance.new("Folder") -- Create leaderstats obv
	Leaderstats.Name = 'leaderstats'

	local Donated = Instance.new("IntValue", Leaderstats)
	Donated.Value = DonatedStore:Get(0) -- Get is basically adding the argumented amount to your saved data
	Donated.Name = "Donated"

	local Raised = Instance.new("IntValue", Leaderstats)
	Raised.Name = "Raised"
	Raised.Value = RaisedStore:Get(0) -- Same thing as above


	DonatedStore:OnUpdate(function(NewDonated)
		Donated.Value = NewDonated
	end)

	RaisedStore:OnUpdate(function(NewRaised) -- Same as above
		Raised.Value = NewRaised
	end)

	Leaderstats.Parent = plr -- Set leaderstats parent AFTER assigning everything

end)
