Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The Save Place API doesn't work, help?

Asked by 10 years ago

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?

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 Bubby4j 231 — 10y

1 answer

Log in to vote
0
Answered by
samfun123 235 Moderation Voter
10 years ago

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!

0
Thanks for the help. It worked a lot. ValkyrieXNominator 0 — 10y
Ad

Answer this question