Hey everyone,
The title explains it all. But for a example, what if I was making a custom character system and you could change its colors from the menu, and it’ll appear in the other games attached to that game?
Hey everyone,
The title explains it all. But for a example, what if I was making a custom character system and you could change its colors from the menu, and it’ll appear in the other games attached to that game?
You could use DataStores, however I would recommend using data stores only to make the data persistent between visits. For persistence in data between different places within a game universe, use TeleportService:SetTeleportSetting() and TeleportService:GetTeleportSetting().
Okay, thanks just learned it!
But how do I do this now? All I can really do is just print something across the places when teleporting
I suppose you could just implement them as tables to retrieve (Preferably a Dictionary), as long as they’re Numbers/Bools/Strings that is
Place #1:
local TPService = game:GetService("TeleportService")
local Colors = {
Red = 200;
Blue = 0;
Green = 100
}
TPService:SetTeleportSetting("ColorTable", Colors)
Place #2:
local TPService = game:GetService("TeleportService")
local ColorTable = TPService:GetTeleportSetting("ColorTable")
print(ColorTable) --Should be a dictionary hopefully
Does this work with _G? (quite obviously im doing this all on the client)
I believe you could, if you mean something like this?
local TPService = game:GetService("TeleportService")
_G.ColorTable = TPService:GetTeleportSetting("ColorTable")
print(ColorTable) --Should be a dictionary hopefully
Other random script in the same place:
print(_G.ColorTable) --Would print the same thing
If you meant like using them in different places whilst referencing the same variable, then I don’t believe you can