generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Data persistance isnt working so great.

Previous Thread :: Next Thread 
tangyboxhead is not online. tangyboxhead
Joined: 23 Oct 2011
Total Posts: 9437
28 Apr 2014 07:39 AM
game.Players.PlayerRemoving:connect(function(player)
player:WaitForDataReady()
player:SaveNumber("savez", player.Character.Torso.CFrame.z)
player:SaveNumber("savey", player.Character.Torso.CFrame.y)
player:SaveNumber("savex", player.Character.Torso.CFrame.x)

end)
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
NZ = player:LoadNumber("savez")
NX = player:LoadNumber("savex")
NY = player:LoadNumber("savey")
NHE = player:LoadNumber("savehealth")

player.Character.Torso.CFrame = CFrame.new(NX,NY + 5,NZ)

end)

it just teleports me to 0,5,0



s ohow would I fix this


Report Abuse
tangyboxhead is not online. tangyboxhead
Joined: 23 Oct 2011
Total Posts: 9437
28 Apr 2014 07:43 AM
I don't think it is saving, lol
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
28 Apr 2014 07:46 AM
While I don't think this it the problem, you didn't save the health.

Here's my siggy... Done.
Report Abuse
tangyboxhead is not online. tangyboxhead
Joined: 23 Oct 2011
Total Posts: 9437
28 Apr 2014 07:56 AM
er I fixed that, by removing load thing, it stil ldoesnt work :/
Report Abuse
tangyboxhead is not online. tangyboxhead
Joined: 23 Oct 2011
Total Posts: 9437
28 Apr 2014 07:59 AM
the wiki wasn't clear lol
Report Abuse
tangyboxhead is not online. tangyboxhead
Joined: 23 Oct 2011
Total Posts: 9437
28 Apr 2014 08:05 AM
lol a bump
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
28 Apr 2014 09:45 AM
game.Players.PlayerRemoving:connect(function(player)
player:WaitForDataReady()
player:SaveNumber("savez", player.Character.Torso.Position.Z)
player:SaveNumber("savey", player.Character.Torso.Position.Y)
player:SaveNumber("savex", player.Character.Torso.Position.X)
end)

game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
player:LoadNumber("savez")
player:LoadNumber("savex")
player:LoadNumber("savey")
--Was never saved
z = player:FindFirstChild("savez")
y = player:FindFirstChild("savey")
x = player:FindFirstChild("Savex")

player.Character.Torso.CFrame = CFrame.new(x,(y+5),z)
end)
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
28 Apr 2014 10:00 AM
Er, the char is gone when the player leaves..

How about a while loop, and a for loop, that saves all the stats
Plradded event
wait for char..
loadpos..
end

While wait () do
iterate thru plrs...
check for char..
savethepositions..
end
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
28 Apr 2014 10:04 AM
that wont work because character is removed befor playerremoving is called

try to create some player stats inside player and update those stats awery 5 sec like

while wait(5)do
if player.Character.Torso then
player.PositionStats.XSave.Value = player.Character.Torso.Position.X
player.PositionStats.YSave.Value = player.Character.Torso.Position.Y
player.PositionStats.ZSave.Value = player.Character.Torso.Position.Z
end
end


and then when playerremoving save those
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
28 Apr 2014 10:05 AM
uh sry island didnt see your post
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image