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

How to create an autosave to save player size?

Asked by 7 years ago

Currently what this script is supposed to do is save the characters BodyWidthScale, BodyDepthScale, etc. when they leave, but that isn't working. But my actual goal for this script is to autosave these values periodically and also load when the player joins the game or resets. Any help would be appreciated!

01local DataStore=game.GetService("DataStoreService"):GetDataStore("SizeSave")
02game.Players.PlayerAdded:connect(function(player)
03    local key = "key-"..player.userId
04    local Humanoid = player.Character:WaitForChild("Humanoid")
05    local Stat = Humanoid:GetChildren()
06    local BHS = Humanoid.BodyHeightScale
07    local BWS = Humanoid.BodyWidthScale
08    local BDS = Humanoid.BodyDepthScale
09    local HS = Humanoid.HeadScale
10    wait(0.5)
11 
12    local save = DataStore:GetAsync(key)   
13    if save then
14 
15        BHS.Value = save[1]
View all 43 lines...

1 answer

Log in to vote
0
Answered by 7 years ago

Easy, all you do is use a Datastore. And the values should automatically save when being reset.

Ad

Answer this question