|
| 04 Feb 2017 04:27 PM |
I want to know if is it possible to save a player's position after he quits and rejoins the game
|
|
|
| Report Abuse |
|
|
Naco88
|
  |
| Joined: 30 Oct 2009 |
| Total Posts: 665 |
|
|
| 04 Feb 2017 04:28 PM |
It's definitely possible yes.
Just look up saving an x, y and z value for a player when say they press a save button.
|
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 04:30 PM |
I would save the Vector3 position every 10 seconds since (I think) you cannot access the position of the character when he is leaving.
Save the individual component of the vector3 position since (correct me on this) you cant save a Vector3 to datastores |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2017 06:19 AM |
I'm not really good in scripting how should I do that ?
|
|
|
| Report Abuse |
|
|
| |
|
Naco88
|
  |
| Joined: 30 Oct 2009 |
| Total Posts: 665 |
|
|
| 05 Feb 2017 06:56 AM |
learn :)))
http://wiki.roblox.com/index.php?title=API:Vector3 http://wiki.roblox.com/index.php?title=Saving_Player_Data
|
|
|
| Report Abuse |
|
|
| |
|
Naco88
|
  |
| Joined: 30 Oct 2009 |
| Total Posts: 665 |
|
|
| 05 Feb 2017 07:03 AM |
If you've never scripted before i wouldn't jump straight into it.
Look at the beginners tutorials on the wiki.
When learning, I had coded a lot before but the wiki tutorials helped me understand it in a day.
:)))
|
|
|
| Report Abuse |
|
|
| |
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 02 Jun 2017 11:55 AM |
| Umm what happened to the script I created you to do this the other day? |
|
|
| Report Abuse |
|
|
|
| 02 Jun 2017 11:57 AM |
| I didn't try it yet xD w8 brb |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Jun 2017 12:05 PM |
dont save a vector3 save a table or string containing the data u need and then convert it back into wat u need |
|
|
| Report Abuse |
|
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 02 Jun 2017 12:08 PM |
| I created him a script the other day to do this. It works fine in a blank project for me, but he says it causes his leaderboard and tools to disappear. Maybe someone will know why. Here is the code. goo.gl/XszgxI |
|
|
| Report Abuse |
|
|
|
| 02 Jun 2017 12:09 PM |
why not save a Vector3
does it have issues
|
|
|
| Report Abuse |
|
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 02 Jun 2017 12:10 PM |
| P.S. I'm having him put it in the ServerScriptService |
|
|
| Report Abuse |
|
|
|
| 02 Jun 2017 12:10 PM |
because u cant save a userdata, it doesnt exist in JSON in JSON u can only have arrays, dictionaries, strings, booleans, numbers anything that is not of that type cannot be encoded into JSON and sent to be saved |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Jun 2017 12:30 PM |
| I will try it and tell you if it works. |
|
|
| Report Abuse |
|
|
|
| 02 Jun 2017 12:31 PM |
Ok, i know how to script but i am not too sure about this topic. I do know there are save buttons in the toolbox, just look it up in models section. They definitely save location and leaderboard stats if u have any. |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Jun 2017 12:34 PM |
heres a couple of examples of converting
print( tostring(Vector3.new()) ) --string version print( Vector3.new(("0, 0, 0"):match("(.-), (.-), (.+)")) )--back
local vector = Vector3.new() print( {x=vector.X, y=vector.Y, z=vector.Z} ) --table version 1
local tbl = {x=0, y=0, z=0} print( Vector3.new(tbl.x, tbl.y, tbl.z) ) --back
local vector = Vector3.new() print( {vector.X, vector.Y, vector.Z} ) --table version 2
local tbl = {0, 0, 0} print( Vector3.new(unpack(tbl)) ) --back
..etc |
|
|
| Report Abuse |
|
|
|
| 02 Jun 2017 12:34 PM |
| Just put teh code in a new Script in ServerScriptService/Workspace |
|
|
| Report Abuse |
|
|
|
| 02 Jun 2017 12:38 PM |
I tried it but I fell from the map and the leaderboard + tools aren't in.
|
|
|
| Report Abuse |
|
|
|
| 02 Jun 2017 12:39 PM |
| Try meh script in a new Place |
|
|
| Report Abuse |
|
|