Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make an enlargement system that saves?

I have a script that when the tool is activated it is supposed to enlarge the player like in Weight Lifting Simulator. I also need the large thing to save if they leave or something like that.

Could someone help me? Thanks in advance!

1 comment

0

I wrote an answer for only the save script. Do you also need the size script? If my answer is all you need, mark as answer so others do not waste time.

1 answer

✓ Accepted answer

You need to use something called Datastores. These are very complex. Here is how you would save: (put in Script in ServerScriptService)

local DSS = game:GetService("DataStoreService")
 local SizeStore = DSS:GetDataStore("SizeSave")
------------------------------------------------------- Start of part 1
game.Players.PlayerAdded:connect(function(player) -- when a player enters
	local leaderstats = Instance.new("IntValue")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	local Size = Instance.new("IntValue")
	local Size.Name = "Size"
	local Size.Parent = leaderstats
-------------------------------------------------- Start of part 2
	local good, bad = pcall(function()
		local data =SizeStore:getAsync(player.UserId .. "size")
	end) 
	if good then
		Size.Value = data
	else
		warn("Error:" .. bad)
	end
----------------------------------------------------- Start of part 3

game.Players.PlayerRemoving:connect(function(player) -- as a player leaves
	local leaderstats = player:FindFirstChild("leaderstats")
	local good, bad = pcall(function()
		SizeStore:setAsync(player.UserId .. "size", leaderstats.Size.Value)
	end) 
	if good then 
		wait()
	else
		warn("Error:" .. bad)	
	end
end)

This may seem complex. I divided the script into 3 parts using ---------. The 2 lines before part1 creates what is called a "Datastore." It is basically a table that saves between servers of a single game (for a more complex answer, visit the wiki or devforum). The first part creates a leaderboard when the player enters. The second part fetches data from a datastore and links it to the leaderboard. The third part activates when a player leaves, and will save the data from the leaderboard to the server. NOTE: This will not work in studio. TEST IN GAME.

This discussion is preserved as it was. New answers, comments, and votes are closed.