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)

4 comments
seems fine, kinda sus.
Try to test this with two players because sometimes player removing doesn't work or doesn't continue because the server closes before the function could ever run
I tried it, still doesnt work.
Are you ever changing the Intvalues? if so, where?