SavePlaceAsync doesnt work

The goal of the script:
Create a place, insert some models, save the place, then copy the place to the player’s inventory.

The problem:
First off, when i goto call
https://developer.roblox.com/api-reference/function/AssetService/CreatePlaceAsync
it doesnt “save” a copy of it in the list of places the group owns, wich is fine
So i went to call
https://developer.roblox.com/api-reference/function/AssetService/SavePlaceAsync
and it gives an error

Code:

local evt = game.ReplicatedStorage:WaitForChild("Btn")
local ts = game:GetService("TeleportService")
local as = game:GetService("AssetService")

evt.OnServerEvent:Connect(function(player)
	print("Saving place")
	as:SavePlaceAsync()
	print("Place saved")
	--[[print("Creating place")
	local placeid = as:CreatePlaceInPlayerInventoryAsync(
		player,
		"Test for " .. tostring(player.Name),
		3220618567,
		"Automatically generated description"
	)
	print("Teleporting player")
	ts:Teleport(placeid, player)]]
end)

The ultimate goal of the code:
To automate selling models to players.
You can see the place here, once i get a working copy of the system, im going to post a guide on here on how to set it up.
https://www.roblox.com/games/3197131211/Tivan-Homestore

2 Likes

Please put your code in a code block by putting ``` at the beginning and end to make it easier for other people to read and help you.

1 Like

done. thanks! been stuck on this for a few days now, ready to get this solved!

1 Like

As a side note, it says in the SavePlaceAsync website that the place has to be created by CreatePlaceAsync for it to work. Is your place created this way?

1 Like

Ill check, thanks for the reply.

2 Likes

From the master place:

local serviceses = {
	["AssetService"] = game:GetService("AssetService"),
	["TeleportService"] = game:GetService("TeleportService")
}
local placeToCopy = 3220618567

local event = game.ReplicatedStorage.ServerEvents.ClickButton.OnServerEvent:Connect(
	function(player, ...)
		print("player: ", player, ...)
		local placeID = serviceses.AssetService:CreatePlaceInPlayerInventoryAsync(
			player,
			"Test for " .. tostring(player.Name),
			placeToCopy,
			"Automatically generated description!"
		)
		serviceses.TeleportService:Teleport(placeID, player)
	end
)

On the cloned place itself:

local evt = game.ReplicatedStorage:WaitForChild("Btn")
local ts = game:GetService("TeleportService")
local as = game:GetService("AssetService")

evt.OnServerEvent:Connect(function(player)
	print("Saving place")
	as:SavePlaceAsync()
	print("Place saved")
	--[[print("Creating place")
	local placeid = as:CreatePlaceInPlayerInventoryAsync(
		player,
		"Test for " .. tostring(player.Name),
		3220618567,
		"Automatically generated description"
	)
	print("Teleporting player")
	ts:Teleport(placeid, player)]]
end)
1 Like

Silly question, but do you have API services and http requests on? It may help, because it seems I’m equally as stumped as you.

sorry for the late reply, i dont even see HttpService in the explorer.

1 Like

HttpService isn’t in the explorer. If you go into studio and click on game settings on the home screen in the top bar and then click options you will see HttpService.

2 Likes

Go to the place settings of the cloned place and make sure you have these options turned on:

(you can go to your cloned place’s settings by going to Develop > Places > Created by My games > View Places)

2 Likes

already did that

I believe SavePlaceAsync has been bugged in general and there’s been no response (the people having issues with it have never filed a bug report, nor has the error message been addressed).

Do a quick check and see if your place saved, as opposed to assuming the method doesn’t work based on the fact that the method throws an error. If you’re still experiencing the issue and the place hasn’t been saved, file a bug report with all relevant information leading up to the error.

1 Like

already checked, it was saved, it was just being temperamental.