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 » Scripters
Home Search
 

Re: Datastore: How to retrieve data from old name?

Previous Thread :: Next Thread 
DarkN3xus is not online. DarkN3xus
Joined: 14 Apr 2013
Total Posts: 94
03 Dec 2015 10:08 AM
Okay, I had a terrible mistake making data save on player.Name instead of player.UserId because when players change their name, their data won't load on old name instead it loads a new data for them since it's a new name. Is there anyway to retrieve old data from player.Name if I change it to player.UserId? because If I switch to player.UserId, It'll reset everyone's data and I'm sure players will get mad...Help asap.
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
03 Dec 2015 10:11 AM
Double post yey

You could probably set up some HttpService API that'll look on the player's profile for u.



-wiki before u forum
Report Abuse
DarkN3xus is not online. DarkN3xus
Joined: 14 Apr 2013
Total Posts: 94
03 Dec 2015 10:13 AM
How to do that?
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
03 Dec 2015 10:14 AM
I'm pretty sure you wouldn't be capable of doing that


-wiki before u forum
Report Abuse
DarkN3xus is not online. DarkN3xus
Joined: 14 Apr 2013
Total Posts: 94
03 Dec 2015 10:16 AM
I have an idea where if the script detects an old player's data on datastore, it should transfer old player's data to new player's data, I just don't know if that's possible...
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
03 Dec 2015 10:17 AM
You can't go through a DataStore without knowing the keys..


-wiki before u forum
Report Abuse
DarkN3xus is not online. DarkN3xus
Joined: 14 Apr 2013
Total Posts: 94
03 Dec 2015 10:19 AM
The keys are player.Name.."Stats9", now is that possible? transferring from player.Name's data to player.UserId's new data?
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
03 Dec 2015 10:20 AM
No because you don't know the player's old name -.-


-wiki before u forum
Report Abuse
DarkN3xus is not online. DarkN3xus
Joined: 14 Apr 2013
Total Posts: 94
03 Dec 2015 10:23 AM
No, It's okay even tho the old player names doesn't go to new data. I just need a script where all old player.Name's data could register in new player.UserId's data...
Report Abuse
DarkN3xus is not online. DarkN3xus
Joined: 14 Apr 2013
Total Posts: 94
03 Dec 2015 10:25 AM
Because if I change the :GetDataStore(player.Name.."Stats9") to :GetDataStore(player.UserId.."Stats9"), It'll reset everyone stats...Is there a way to transfer (player.Name.."Stats9") data to the new (player.UserId.."Stats9")?
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
03 Dec 2015 10:27 AM
Lua doesn't see DataStore keys as "player names", it interprets them as strings.
Meaning that if a player changes their name, the key won't change with it.

It's kinda too late now to transfer data because ROBLOX hasn't really got any simple ways to get a player's old names.
Although you could make some PHP API outside ROBLOX using proxies that can get information from ROBLOX (in this case the player names from the player profiles).

But I won't be able to help you with that rn d;


-wiki before u forum
Report Abuse
DarkN3xus is not online. DarkN3xus
Joined: 14 Apr 2013
Total Posts: 94
03 Dec 2015 10:31 AM
Oh, That's sad to know :c I guess I'll be changing it to UserId now and would reset everyone stats...
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
03 Dec 2015 10:33 AM
Well you could like check if it can find the player's name in the DataStore, then set everything it found there to the player's userId in another DataStore.

If it can't find stuff for the name (example when a player changed his name), just let that go and 'reset', but save the new information to the userId.


-wiki before u forum
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
03 Dec 2015 10:34 AM
why would you make a new datastore for each player

just make one and set the keys as players' userids
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
03 Dec 2015 10:39 AM
I didn't say per player

ew how inefficient


-wiki before u forum
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
03 Dec 2015 10:47 AM
@Happy

Having a datastore for each player is actually nice to do

That way you can have a datastore (Like a MySQL Table) that saves keys of each data
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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