Help With Currency system

ok. Do i hafto put anything under Replicated Storage

Using :BindToClose to just run wait(5) does nothing. You would want to put your actual saving code here. Also, when replying actually format your code. Your code is super sloppy right now.

can someone help me with this pls

Yes, I would love to help you. Could you send your code to me where it is all formatted? Then I will walk you through this.

ok thank you so much! this ia my code and its all under ServerScriptService

game.Players.PlayerAdded:Connect(function(player)
local folder = Instance.new(“Folder”,player)
folder.Name = “leaderstats”
local currency1 = Instance.new(“IntValue”)
currency1.Name = “Money”
currency1.Parent = folder

player.CharacterAdded:Connect(function(character)
	character:WaitForChild("Humanoid").Died:Connect(function()
		local tag = character.Humanoid:FindFirstChild("creator")
		if tag ~= nil then
			if tag.Value ~= nil then
				currency1.Value = currency1.Value + 10 
			end 
		end
	end)
end) 

end)

Okay, so we need to use DataStoreService and then :GetDataStore

We get a key for each player by using :GetAsync(player.UserId), which gets the player data when they join.

When a player leaves we save their data with :SetAsync(player.UserId, value)

If you want to go the extra mile you can make sure when roblox errors that player data isn’t lost with pcalls

So your script should look something like this when you are done:

local DSS = game:GetService("DataStoreService")
local DS = DSS:GetDataStore("IReallyLikeMoney")

game.Players.PlayerAdded:Connect(function(player)
	local folder = Instance.new(“Folder”,player)
	folder.Name = “leaderstats”
	local currency1 = Instance.new(“IntValue”)
	currency1.Name = “Money”
	currency1.Parent = folder
	currency1.Value = DS:GetAsync(player.UserId) or 0

	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
			local tag = character.Humanoid:FindFirstChild("creator")
			if tag ~= nil then
				if tag.Value ~= nil then
					currency1.Value = currency1.Value + 10 
				end 
			end
		end)
	 end) 
end)

game.Players.PlayerRemoving:Connect(function(player)
	DS:SetAsync(player.UserId, player.leaderstats.Money.Value)
end)

game:BindToClose(function()
	for _,v in pairs(game.Players:GetPlayers())do
		DS:SetAsync(v.UserId, v.leaderstats.Money.Value)
	end
end)

Let me know if you have any questions!

ya i have one question where do i put this ?

You take the code that I made and put it where your code is in ServerScriptService.

its giving me so many errors ?

It shouldn’t. Could you give me a list of the errors please?

Look where it has the " and retype it. Sometimes it errors with a copy and paste.

where im not seeing where that is

Dude, legit right in front of your face on line 5, 6, 7, 8, and 9.

that did not fix the problem it looks right

it fixed some of the problem but theres still some there now underlined

Show me another screen shot of the current script.

I said delete the " and retype it, there has been way to many replies for a simple answer.

ok I’m pretty sure i got it this time