My datastore script seems to not work, can anyone please help me fix my datastore script?
Asked by
7 years ago Edited 7 years ago
I can't seem to get this script going.
01 | local DSS = game:GetService( "DataStoreService" ) |
02 | local HeavySet = DSS:GetDataStore( "HeavySet" , "Players" ) |
04 | game.Players.PlayerAdded:connect( function (plr) |
06 | print ( "Loading in " ..plr.Name.. "s Items" ) |
07 | local Key = plr.UserId |
08 | local MainGui = plr.PlayerGui:WaitForChild( "MainGui" ) |
09 | MainGui:WaitForChild( "Items" ).HeavySet.Value = HeavySet:GetAsync(Key) |
10 | HeavySet:SetAsync(Key, MainGui:WaitForChild( "Items" ).HeavySet.Value) |
11 | print ( "Loaded in Items" ) |
14 | game.Players.PlayerRemoving:connect( function (plr) |
15 | print ( "Saving " ..plr.Name.. "s Items" ) |
16 | local Key = plr.UserId |
17 | local MainGui = plr.PlayerGui:WaitForChild( "MainGui" ) |
18 | HeavySet:SetAsync(Key, MainGui:WaitForChild( "Items" ).HeavySet.Value) |
Please I beg someone to answer this question please!