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

Set Datastore Data doesnt transfer from server to server?

my data saves and loads inside the same server switching servers doesnt bring your saved stats from another

this problem occurs were it says

if data == "save" then
local event1 = Instance.new("RemoteEvent",game.ReplicatedStorage)--outfit1
event1.Name = "outfit1"
local event2 = Instance.new("RemoteEvent",game.ReplicatedStorage)
event2.Name = "outfit2"
local event3 = Instance.new("RemoteEvent",game.ReplicatedStorage)
event3.Name = "outfit3"


event1.OnServerEvent:connect(function(player,plr,data)
    print 'fired'
    local outfit1 = game:GetService("DataStoreService"):GetDataStore("Outfit1")
    local key = "player-"..plr.userId
    local plrstats = plr.Customization--Order in stats are saved {Hairs,Face,SkinColor,Shirt,Pants,Accessories1-5"}

    local vals = {
        plrstats.Hair,
        plrstats.Hair2,
        plrstats.Face,
        plrstats.Shirt,
        plrstats.Pants,
		plrstats.SkinColor,
        plrstats.Accessory1,
        plrstats.Accessory2,
        plrstats.Accessory3,
        plrstats.Accessory4,
        plrstats.Accessory5,
    }

    local valsToset = {}
    for k,v in pairs(vals) do
        valsToset[k] = v.Value
    end

    local saves = outfit1:GetAsync(key)
	
if data == "save" then
    outfit1:UpdateAsync(key,function(saves)
	local newvals = valsToset
	for i,v in pairs(newvals) do 
		saves[i] = newvals[i]
		return newvals
	end
	end)
end
  

if data == "load" then
        print 'loading'
	for i,v in pairs(vals) do      
    	vals[i].Value = saves[i]
    	print(saves[i])
	end
end


if data == "check" then
    print 'checking'
    for i,v in pairs(saves) do      
    	print(saves[i])
   	end
end



end)



1 answer

Make sure your game is apart of a universe. The datastore will not transfer if it is not part of the universe.

You can read more about universes here

Once your universe is set up, you can transfer data from the datastore! :)

1 comment

0

But its only a one place game

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