Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with DataPersistance? (And Don't say DataStores are better. They're a pain in the backside!)

Asked by 7 years ago

I've attempted DataStores, and even with ScriptGuider's help, I have no clue. So I've resorted to DataPersistance, but once again, it won't *~%"£$% work.

local group = 1234 --GroupID

game.Players.PlayerAdded:connect(function(player)
    if player:WaitForDataReady() then
        local leadr = Instance.new("IntValue",player)
        leadr.Name = "leaderstats"
        local rank = Instance.new("StringValue",leadr)
        rank.Name = "Rank"
        local department = Instance.new("StringValue",leadr)
        department.Name = "Department"  
        if player:IsInGroup(group) then
            rank.Value = player:GetRankInGroup(group)       
            department.Value = game.Players[player.Name]:LoadString("Department") --Load the Department
            while wait(30) do
                rank.Value = player:GetRankInGroup(group)
            end
        else
            rank.Value = "Guest"
            department.Value = "N/A"
        end
        player.leaderstats.Department.Changed:connect(function()
            game.Players[player.Name]:SaveString("Department", player.leaderstats.Department.Value) --Save the Department
        end)
    end   
end)

There's no error, but the value won't load. Which is pretty annoying as DataStores won't work, nor will this.

0
Data Persistance is deprecated, and not guranteed to work. Use data stores instead. :SetAsync(), :UpdateAsync(), and :GetAsync() are the major functions of data stores. Also know :GetDataStore(). GoldenPhysics 474 — 7y

2 answers

Log in to vote
1
Answered by 7 years ago

https://scriptinghelpers.org/questions/33259/is-there-any-way-to-save-values-to-a-player-and-load-it-when-they-return#36073

I did my best to explain DataStores to their most basic usage! :) Please do check it out if you'd like to learn.

0
Nice tutorial. Helped me a lot. Thanks. TheHospitalDev 1134 — 7y
0
Thank you! I did try my best. TestingPlace1337 51 — 7y
Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Data Store is actually better... Here's a link to a good tutorial - https://www.youtube.com/watch?v=Nfm-CtRUNqk

Answer this question