Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

The Save Place API doesn't work, help?

This was added to the brick and tested but didn't work.

local Trigger = script.Parent
 
function debounce(func)
    local isRunning = false
    return function(...)
        if not isRunning then
            isRunning = true
            func(...)
            isRunning = false
        end
    end
end
 
function getPlayer(Part)
	local Humanoid = Part.Parent:FindFirstChild('Humanoid')
	if (Humanoid ~= nil) then
		local Character = Humanoid.Parent
		if (Character ~= nil) then
			return game:GetService('Players'):GetPlayerFromCharacter(Character)		
		end
	end
end
 
function _savePlace(player)
	game:GetService(“AssetService”):SavePlaceAsync()
end
local savePlace = debounce(_savePlace)
 
function onTouch(Source)
	local player = getPlayer(Source)	
	if player then
		if player.userId > 0 then	
			local success, error = ypcall(function() savePlace(player) end)
		end		
	end	
end
 
Trigger.Touched:connect(onTouch)

Do I have any problems?

1 comment

0

Did you check that it's actually enabled for the place? See: http://wiki.roblox.com/index.php?title=Dynamic_place_creation_and_saving

1 answer

The main problem might be that if you go to configure the universe the field "Allow this place to be updated using the Save Place API in your game." is unchecked.

If the place is configured right the page should look something like this.

If you have any questions, concerns or just need some help with this PM me on ROBLOX!

1 comment

0

Thanks for the help. It worked a lot.

This discussion is preserved as it was. New answers, comments, and votes are closed.