I won't my datastore to save "StringValue" is it unsupported or it is a script error it just changes it to a number?
Server Script:
--DataStores local DataStore = game:GetService("DataStoreService") local DataStore_oofs = DataStore:GetDataStore("SaveSystem_oofs") local DataStore_rank = DataStore:GetDataStore("SaveSystem_rank") --Create leaderboard game.Players.PlayerAdded:Connect(function(player) --Create Leaderboard local LeaderBoard = Instance.new("Folder",player) LeaderBoard.Name = "leaderstats" --Create Values local Oofs = Instance.new("NumberValue",LeaderBoard) Oofs.Name = "Oofs" Oofs.Value = 0 local Rank = Instance.new("StringValue",LeaderBoard) Rank.Name = "Rank" Rank.Value = "New Oofer" wait(1) --Load Oofs.Value = DataStore_oofs:GetAsync(player.UserId, Oofs.Value) Rank.Value = DataStore_rank:GetAsync(player.UserId, Rank.Value) end) --Save Data game.Players.PlayerRemoving:Connect(function(player) --Varibles local Oofs = player.leaderstats.Oofs local Rank = player.leaderstats.Rank --Save DataStore_oofs:SetAsync(player.UserId, Oofs.Value) DataStore_rank:SetAsync(player.UserId, Rank.Value) end)
If there is a way to save string values, please explain?
If the player is added, then it would get a sync to the strings after dying I guess. So insert this inside game.Players.PlayerAdded:Connect(function(player)
and replace it with the other GetASync
local InStudio = game:GetService("RunService"):IsStudio() if not InStudio then Oofs.Value = DataStore_oofs:GetAsync(tostring(player.userId)) or 0 Rank.Value = DataStore_rank:GetAsync(tostring(player.userId)) or "New Oofer" else Oofs.Value = DataStore_oofs Rank.Value = DataStore_rank end
This is probably the solution.
--DataStores local DataStore = game:GetService("DataStoreService") local DataStore_oofs = DataStore:GetDataStore("SaveSystem_oofs") local DataStore_rank = DataStore:GetDataStore("SaveSystem_rank") --Create leaderboard game.Players.PlayerAdded:Connect(function(player) local key = "id_" .. player.UserId --Create Leaderboard local LeaderBoard = Instance.new("Folder",player) LeaderBoard.Name = "leaderstats" --Create Values local Oofs = Instance.new("NumberValue",LeaderBoard) Oofs.Name = "Oofs" Oofs.Value = 0 local Rank = Instance.new("StringValue",LeaderBoard) Rank.Name = "Rank" Rank.Value = "New Oofer" wait(1) --Load if DataStore_oofs:GetAsync(player.UserId) and DataStore_rank:GetAsync(player.UserId) then Oofs.Value = DataStore_oofs:GetAsync(key) Rank.Value = DataStore_rank:GetAsync(key) else return end end) --Save Data game.Players.PlayerRemoving:Connect(function(player) local key = "id_" .. player.UserId --Varibles local Oofs = player.leaderstats.Oofs local Rank = player.leaderstats.Rank --Save DataStore_oofs:SetAsync(key, Oofs.Value) DataStore_rank:SetAsync(key, Rank.Value) end)