Help with Fixing My Code


See thats my other script without the leaderstats killing script its not the other scripts bothering it. I only changed the datastore

Since you disabled the script that would be like kill a player for gold, maybe it changed some stuff in the leaderstats? Could you show the script you disabled?

did you put three more end)s in it

Okay let me explain thats the script that works for sure and thats the script without the killing script, but I want to add the killing script somehow I want players to get money when the ykill

local DataStore2 = require(1936396537)


	local dataGold = DataStore2("Gold", plr)
	local folder ="Folder",plr)
	folder.Name = "leaderstats"
	local gold ="IntValue", folder)
	gold.Name = "Gold"
	if dataGold:Get() ~= nil then
		gold.Value = dataGold:Get()
		gold.Value = 100

maybe you can put it in another script

You mean my kill script how I tried using my whole kill script inside another script and named a new leaderstats named gold again but it lags it.

you can put the kill script in a different script you dont need to put the leaderstats with it

That is what I mean but how would I refer to teh datastore 2? Can you help me fix?

Just change the leaderstat value and it will save because you set it before so it will save when changed

	local folder ="Folder",player)
	folder.Name = "leaderstats"
	local currency ="IntValue",folder)
	currency.Name = "Gold"
			local tag = character.Humanoid:FindFirstChild("creator")
			if tag ~= nil then
				if tag.Value ~= nil then
					local stats = tag.Value:WaitForChild("leaderstats")
					stats["Gold"].Value = stats ["Gold"].Value + 150

That is my kill script for anotehr script as you said how would I fix it?

Take only the humanoid died part

So how would I use that to make it be able to relate to DataStore2 Can you like show me?

ok so in your datastore script it saves the data when the value is changed so just update the value amd it will save leaderstats value

Okay but its a new script so it changes how would I fix my kill scrip?

put your kill script in the startercharacter scripts

So dont erase anything inside it right now?

Make sure you are only moving the kill script and not the datastore script too

okay wait but the problem is for my kill script I made a new leaderstats thats named gold so it might get confused