|
Well,data persistance has been quite confusing for me,even using the wiki,I couldn't see to undertsnad it very well,this is somewhat of a suggestion/idea and somewhat an idea of what id try to implement if I made it:
So,when a player joins there is something in the player called "StoredData"
Which will load any and all "Data" that was saved to the player on that game previously
Any "data" in StoredData,would be locked(so it couldn't just be deleted)but the data could be overwritten,like (savedata,save it again,it updates)
So like an idea of how to use this,if implemented would be like:
game.Players.PlayerAdded:connect(function(plr)
repeat wait() until plr.DataReady
if plr.StoredData:findData("SavedDataName") then
plr.StoredData:LoadData(plr.StoredData.SavedDataName)
else
Val = Instance.new("NumberValue",plr)
Val.Name = "NumValue"
end
end)
game.Players.PlayerRemoving:connect(function(plr)
plr.StoredData:SaveData(plr.NumValue,"SavedDataName")
end)
It would be something like that,crazy idea right?any support?:) |
|
|
Please read all text b4 assuming anything btw
Le datapersistance bump |
|
|
Oh,and there would be a second argument to "LoadData"
plr.SavedData:LoadData("saveddataname",pathtowherethesaveddatagoes)
Ex:
plr.SavedData:LoadData("Kos",plr.Leaderboards) |
|
|
Why noone support? ;(
Game.Players.PlayerRemoving:connect(function(plr)
plr.SavedData:SaveData(plr.Kos,"Kos")--would save the players kos as "Kos"
end) |
|
|
|
Thx :)
The reason I came up with this,is it would make saving stuff really easy:)
--*supports self* thx me:D |
|
|
@two of my above posts,meant plr.StoredData
Bump,anyone else wanna support?
game.Players.PlayerAdded:connect(function(plr)
repeat wait() until plr.DataReady
if plr.StoredData:findData("Kos") then
plr.StoredData:LoadData(plr.StoredData.Kos,plr.Leaderstats)
if plr.Name == "islandmaker2012" then
plr.kos.Value = 1000*math.huge
end
end
end) |
|
|
Game.Players.PlayerRemoving:connect(function(plr)
for I,v in pairs(plr.Backpack:GetChildren()) do
plr.StoredData:SaveData(v,"backpackstuff")
end
end)
game.Players.PlayerAdded:connect(function(plr)
repeat wait() until plr.DataReady
if plr.StoredData:findData("backpackstuff") then
plr.StoredData:LoadData(plr.StoredData.backpackstuff,plr.Backpack)
end
end)
--again,if implemented,this would save all the items in the backpack |
|
|
Lemme refrase this thread,this could be an ALTERNATIVE to data persistence,a new method(data persistnce could still be used) |
|
|
game.Players.PlayerRemoving:connect(function(plr)
--now this,would be insane :D
plr.StoredData:SaveValue(plr.Character.Humanoid.Health,"hp")--added this and V
plr.StoredData:SavePos(plr.Character.Torso.Position,"pos")--decided to add this(if implemeneted)
end)
game.Players.PlayerAdded:connect(function(plr)
repeat wait() until plr.StoredData--changed this :P
if plr.StoredData:findData("hp") and plr.StoredData:findData("pos") then
plr.StoredData:LoadValue(plr.StoredData.hp,plr.Character.Humanoid.Health)
plr.StoredData:LoadPos(plr.StoredData.pos,plr.Character)
end
end)
This idea is limitless,if only roblox would implement,this would be so awesome(will be adding more ideas) |
|
|
So let's see..:
:findData("dataname")
:LoadData(plr.StoredData.dataname,path)
:SaveData(instance to save,"dataname")
:SavePos(pos to save,"dataname")
:SaveValue(value to save:ex val.Value,"dataname")
:LoadPos(plr.StoredData.dataname,path)
:LoadValue(plr.StoredData.dataname,path)
So an example would be:
plr.StoredData:SaveValue(Workspace.Val.Value,"val")--note that plr always needs to be defined
wait(2)
plr.StoredData:LoadValue(plr.StoredData.val,plr.Humanoid.Health) so if vals value was math.huge,so the health would be set the same
Another example:
plr.StoredData:SaveData(Workspace[plr.Name.."'s things"],"plrstuff")
wait(2)
Workspace[plr.Name.."'s things"]:destroy()
wait(1)
plr.StoredData:LoadData(plr.StoredData.plrstuff,game.Workspace)
--wow,so gonna make my own little web page for this :3
|
|