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

Datastore that saves user's progress in a story? (more details after click)

I am currently creating a visual novel, and I want the player to be able to MANUALLY save at any point in time, and once they rejoin, they can click load and it will bring them back to where they were.

How??? I can't think of any ways of making a dialogue system where the player can save at any point in time manually, the game is completely GUI.

What I'd like to know: How should I script the story telling in order to make saving possible?

4 comments

1

The only way I can think of this at the moment is making every single dialogue in the GUI have a special number? I am sure theres a way better way of doing this. But you could save the number that the player was on and when they rejoin the script will know the number then associate it with the dialogue that has the same number. Please wait for more responses as this one is really inefficient!

0

Definitely inefficient, but it would work! I'll refer to this if future responses cannot answer.

0

I'd Recommend having a folder with sections of the story stored inside and to save based off of that and to load it based off of the name of the section.

0

how would I load specific sections?

1 answer

Create a button labeled save. Create a RemoteEvent in ReplicatedStorage called "Save". The LocalScript in the button should look like this

script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.Save:FireServer()
end)

Catch the event with a Server Script in ServerScriptService and then save. The server script will look something like this

local LocationSave = game:GetService('DataStoreService'):GetDataStore('SameRandomName')

game.ReplicatedStorage.Save.OnServerEvent:Connect(function(plr)
	local s, e = pcall(function()
		LocationSave:SetAsync(plr.Character.HumanoidRootPart.CFrame)
	end)

	if not s then
		error(e)
	end
end)

This will save their location in the DataStore. I hope I didn't make any mistakes

8 comments

0

But how would I use this to get them back where they were using the load button?

0

how would you save the characters position within a gui??

0

The position of the player is stored in their HumanoidRootPart while they play. When they click the button, the LocalScript sends a signal to the Server script which saves their position in a DataStore. That position can then be accessed once they rejoin the game. After a script for loading the data gets the position of the player, it can spawn them their again. Unless you mean a GUI's position?

0

Sorry if you mean that you want to save the position of a GUI. In that case send the position of the GUI through the Remote Event

0

I want to save their location in the story, meaning at what poin they are in the story, and send themback to it. It's GUI and has nothing to do with playr pos lol

0

Saving everytime someone clicks is a very, very bad idea. Its going to throttle your game's requests.

0

Then you need a debounce and have the player wait 30 seconds before clicking the button again

0

I mean it's a single player game and mainly gui- I doubt they'd spam click the save button, 30 second debounce might get annoying.

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