How could i send data between places in a game universe?

I’m trying to make it so the player can choose like different body colours in the starter place of the game, then if they join a specific place in the same game universe, their avatar will be the one they chose from starter place. I dont need to know how i can change body colours, i just need to know how i can basically send that avatar into another place when the user joins the specific place. All i know right now is data stores can maybe do something, i heard you can have the same data stores in a game universe if you name it the same.

2 Likes

Yes, you can use DataStoreService for this purpose. Another (but can be unprotected) way of handling this is using TeleportService:Teleport()'s TeleportData property. If you know how to handle it, I would suggest using it instead of DataStoreService, as it might save you some of the hassle.

2 Likes

Thanks but how can i save the brick color value? Data stores apparently dont accept a brick color value.

I would give the player for example five choices for the Body color and save ever color as a custom Value(for example: red = 1, blue = 2, etc). And when the players changes the server i would send that Value with him so the other Server knows wich color he chose.sry for bad english

1 Like

So like, basically make an int value, and make a script so if the int value is for example 1, the brick color value will be red?

1 Like

I wouldn‘t use a Int Value, i would use a Table or Variable, but your right, Yes.

1 Like

I would suggest saving the BrickColor name for the TeleportData. You can do this via BrickColor.Name.

I have 1 more issue though, when i insert the exact same script which inserts the int values inside the player into the place and the starter place (basically they are the same scripts), and insert the same datastore scripts too, it doesnt use the values that got saved in the starter place.

Like, they wont transfer the datastores, even though they have the same datastore names too.

Are you sure it’s in the same ‘universe’, or different Roblox experiences?
Usually, in your Asset Manager, you’d see this:
image

Absolutely, i can see my place in the same universe.

Your datastores may not be updating fast enough, then. I’d suggest using TeleportData instead as it’s easier to work with.

Place inside the same universe

Starter Place of the universe


Maybe i have something wrong in the scripts?

1 Like

You can either use MessagingService | Roblox Creator Documentation or DataStoreService | Roblox Creator Documentation

Ive been using that, what i need to know is maybe i have something wrong with my scripts, because they dont use the same data stores as in the starter place, when the place is in the same game universe as the starter place.

Your IntValues might be initialized after the DataStore script has ran, causing an error since you aren’t using plr:WaitForChild(…). Try this instead of automatically assuming that all of the colors already exist.

Some sidenotes:
plr.userId is deprecated, use plr.UserId
Since your data may be overridden if you change the way data’s formatted, I’d suggest having the key value of SetAsync be only the player’s UserId. This might also solve issues down the line.

Nevermind, i found it out myself, what happened is in the script that basically makes it so if the int value is 1, it would be red for example, i didnt put a loop so it immediately ran when the datastores didnt load yet.

2 Likes