Can't find place created with :CreatePlaceAsync()

I am attempting to create a game where players can create their own “worlds” (places) that they can do whatever they’d like in. So far I am able to create a place and teleport the player to it, however after that I can’t find the place in the universe, therefore the player can not revisit their place at a later time.

Here is my code for creating a place:

game:GetService("ReplicatedStorage").create.OnServerEvent:Connect(function(Player)
	print("making")
	local place = game:GetService("AssetService"):CreatePlaceAsync(Player.Name,2923944017,"User place")
	print("made, teleporting")
	print(place)
	game:GetService("TeleportService"):Teleport(place,Player)
	print("teleported")
end)

Why can’t I have a player rejoin the place at a later date?

3 Likes

Everytime you call CreatePlaceAsync it’ll create a new place with the player’s name. It doesn’t care if a similar named place exists, it’ll create a new one anyways. You have to store the “place” variable’s value in a datastore and teleport to it if the player already has a place. You’re currently creating a whole new one each time the RemoteEvent is called.

2 Likes

Okay, but I still don’t understand why the place won’t show up when I look at all places in the universe.

They’re placed in your inventory, not the game universe if I’m right.

Clones a place with placeId equal to given templatePlaceId. It is placed into the inventory of the place’s creator with the given name and description.

Ohhh, I completely missed that. But then how would I be able to rejoin that place at a later time then?

Basically CreatePlaceAsync returns the PlaceId of the newly created place, when a player creates a place store the PlaceId in a DataStore. When the player requests to join it, take the PlaceId from the DataStore and teleport the player to it.

Okay, that makes sense. Thanks!

Np!

1 Like

If you’re wondering where the places are under the develop page, you can find these places in your inventory when you look for places created by “My Games” instead of places created by “Me.”


You should definitely go with Dysche’s method of storing them in datastores though.

Yeah, I went with the data store method. It works really good. Whenever someone creates a place, I’ll create a new entry in the database with the key being the player’s username and the value being the placeid. This method also makes it easy to join other player’s places by searching their username and simply looking for the data store entry with that key.

2 Likes

I highly suggest using the player’s UserId instead of username. Players can change their usernames, if they do they’ll lose their DataStore entry.

2 Likes