I am making a game entitled "Square RPG," and as an RPG, the current location of the player, as well as the stats, should be saved. However, I have not found a good source for learning how to go about implementing a script to save. Is anyone aware of a good source to learn? Or, if it is not against the guidelines, can you perhaps teach me how yourself?
Many thanks, --Crystakyl.
i dont know if this will help you but this helped me start https://www.youtube.com/watch?v=VXcbZ2kurvk
Message me on roblox > TriickXzoniQ for further questions. But how ever, i save my data in models or instances. For example, your making a rpg, you need to save; -Gold Currency -Xp Stats -Level * Progress*
I've set up my data save to work like so
Player Model -- What exactly is being saved < Gold --Number Value Xp --Number Value Level --Number Value
You can use data store so it saves >Model and all of it's contents, and loads it when a player joins. If the player does not have it however, it still loads it. Heres the script;
SavedFile = "File3"
Server = "ServerSet1"
function PlayerAdded(Player)
Player:WaitForDataReady()
if Player:LoadInstance(SavedFile) == nil then
Instance.new("Model",Player).Name = "Stats"
Instance.new("NumberValue",Player.Stats).Name = "Gold"
Instance.new("NumberValue",Player.Stats).Name = "Xp"
Instance.new("NumberValue",Player.Stats).Name = "Level"
elseif Player:LoadInstance(SavedFile) ~= nil then
Player:LoadInstance(SavedFile).Parent = Player
print ('Player Had File')
end
end
function PlayerRemoved(Player)
Player:WaitForChild("Stats")
Player:SaveInstance(SavedFile,Player.Stats)
end
game.Players.PlayerRemoving:connect(PlayerRemoved)
game.Players.PlayerAdded:connect(PlayerAdded)