Data Store saving

Hello, i was wondering how can i save my Character’s Size basically, the values: HeadScale, BodyDepthScale, BodyWidthScale, BodyHeightScale, and properties? for example the Mesh Scale, also when i reset how do i make so it saves my Character’s size because it doesnt when i reset, when i reset it sets to default, would be nice if someone can provide me an example using DataStoreService :pray:

2 Likes

You can put each property in a table: local table = {Humanoid.Headscale.Value, extra} then you can just save that table. Hope that helps!

1 Like

Is it possible an example including it saving, nothing hard just saving it so i can use that example and make something better out of it

Sure, sorry for the late reply. Here is the code to save the data:

    local dataStoreService = game:GetService('DataStoreService')
    local charData = dataStoreService:GetDataStore('CharData')
    local plrStats = {}
	local char = plr.Character or plr.CharacterAdded:Wait()
	
	local success, errormessage = pcall(function()
		table.insert(plrStats, char.Humanoid.HeadScale.Value)
		table.insert(plrStats, char.Humanoid.BodyHeightScale.Value)
		table.insert(plrStats, char.Humanoid.BodyProportionScale.Value)
		table.insert(plrStats, char.Humanoid.BodyTypeScale.Value)
		table.insert(plrStats, char.Humanoid.BodyWidthScale.Value)
		
		charData:SetAsync(plr.UserId, plrStats)
	end)
	
	if success  then
		warn('success')
	else
		warn(errormessage)
	end
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.