I have followed tutorials and did everything they told me to do but the script won't work and there is nothing in the output. the only thing I changed is that there isn't a leaderstats folder but it just has a different name.
here is the script
local DataStoreService = game:GetService("DataStoreService") local DataStore = DataStoreService:GetDataStore("DataStore") local GravelCo = DataStoreService:GetDataStore("GravelCo") game.Players.PlayerAdded:Connect(function(player) local Data = Instance.new("Folder") Data.Name = "DataFolder" Data.Parent = player local GravelColor = Instance.new("IntValue") GravelColor.Name = "GravelColor" GravelColor.Parent = Data local data local success, error = pcall(function() data = GravelCo:GetAsync(player.UserId.."-GravelColor") end) if success then GravelColor.Value = data else warn(error) print("error saving") end end) game.Players.PlayerRemoving:Connect(function(player) local success, error = pcall(function() GravelCo:SetAsync(player.UserId.."-GravelColor",player.DataFolder.GravelColor.Value) end) if success then print("data Saved") else print("error Saving") warn(error) end end)
You don't have to do userid-GravelColor, you can just use the id. Not forcing you to change it but just a reminder.
Also, It might be because your 'error' in pcalls are already a function inside lua. To fix this maybe try doing _error.
Plus, it's an intvalue, not a color/string value. Are you sure you're doing colors by numbers? Have a little debug, see if you can get a result.
game.Players.yasquerda.DataFolder.GravelColor.Value = 1 leave game rejoin game print(game.Players.yasquerda.DataFolder.GravelColor.Value)
Use dev console for this (press F9 and switch to server tab on output). Btw you can't run datastores in studio.