So basically I'm trying to save a value called "Electric", this value will be stored between a value of 0 and 1. There's no issue with the console, and it even says it's working. However, I've found that it loads correctly but it doesn't save correctly. There's no blatant issue here and I've also tested it on Roblox, same result, it doesn't work. (also please don't be one of those people who are like oOoOoo use bind to close)

Script:


local DataStoreService = game:GetService("DataStoreService")

local myDataStore = DataStoreService:GetDataStore("myDataStore2")

game.Players.PlayerAdded:Connect(function(player)
	local Origin = Instance.new("Folder")
	Origin.Name = "Origin"
	Origin.Parent = player

	local Electric = Instance.new("IntValue")
	Electric.Name = "Electric"
	Electric.Parent = Origin

	local data
	local success, errormessage = pcall(function()
		data = myDataStore:GetAsync(player.UserId.."-Electric")
	end)

	if success then
		Electric.Value = data
		print("Hothkinstroy is best coder :O")
	else
		print("HOTHKINSTROY SUCKS AT CODING LOL HE CANT CODE SOMETHING THIS SIMPLE")
		warn(errormessage)
	end
end)

game.Players.PlayerRemoving:Connect(function(player)

	local success, errormessage = pcall(function()
		myDataStore:SetAsync(player.UserId.."-Electric", player.Origin.Electric.Value)
	end)

	if success then
		print("Hothkinstroy best coder :o")
	else
		print("HOTHKINSTROY IS THE WORST CODER HE CANT EVEN CODE A BASIC SCRIPT THIS SIMPLE LOL")
		warn(errormessage)
	end
end)

3 comments

0

where are you updating the values?

0

Using a click script, didn't work, tried doing it manually, didnt work

0

the click script had no issues