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

How can i save the face of a decal in data store?

Im testing out data store to save instances (lol) but i cant seem to save the face of a decal.

saving:


dataStore = game:GetService("DataStoreService"):GetDataStore("WOAH")
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
local models = game.ReplicatedStorage.Model

local e = {}
for i, obj in pairs(models:GetDescendants()) do
    if obj:IsA("Decal") then
        table.insert(e, {
            ["ParentName"] = obj.Parent.Name;
            ["Texture"] = obj.Texture;
["Transparency"] = obj.Transparency;
["Face"] = tostring(obj.Face);
})
    end
end
dataStore:SetAsync("key", e)
end)

loading:


dataStore = game:GetService("DataStoreService"):GetDataStore("WOAH")
game.ReplicatedStorage.RemoteEventr.OnServerEvent:Connect(function(plr)
	local xd = dataStore:GetAsync("key") or {}
	if xd then
		    for i, v in pairs(xd) do
        if  v then
            local SavedModel = game.ReplicatedStorage.Model

            if SavedModel then
                local Model = SavedModel:Clone()
                Model.Parent = workspace
local decal = Instance.new("Decal")
decal.Transparency = v.Transparency
decal.Texture = v.Texture
decal.Parent = Model.Model[v.ParentName]
            end         
        end  
    end 
	end
end)

3 comments

0

U simply cant.

0

orojgioregrekge ok thx

0

You CAN

1 answer

You seem to want to save an decal, but the only way to do it is to save its URL.

Every single decal has an URL. It symbolizes which image it is, like the player ID, which symbolizes which player it is. The only change you have to do is to save the URL, not the image.

And when you load it, create an simple decal and set its Texture property to "rbxassetid://" .. tostring(URL)

1 comment

0

that's not what he's asking xd

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