I'm struggling for searching for sharing my script to other place i saw some people said that data store is needed to pass it to other place but i already do it and also check the Enable Studio Access to API Services but still its not working so is anyone have an idea how other do that or where they get the information to do it?
local datastore = game:GetService("DataStoreService"):GetDataStore("experiment-datastore")
local Statsfolder = script.Stats
game.Players.PlayerAdded:Connect(function(newplayer)
local key = "Player-ID:"..newplayer.UserId
local GetSave = datastore:GetAsync(key)
local newStatsfolder = Instance.new("Folder",newplayer)
newStatsfolder.Name = "leaderstats"
for i,Stats in pairs(Statsfolder:GetChildren())do
local newStats = Instance.new(Stats.ClassName)
newStats.Name = Stats.Name
newStats.Value = Stats.Value
newStats.Parent = newStatsfolder
end
if GetSave then
for i,Stats in pairs(script.Stats:GetChildren())do
newStatsfolder[Stats.Name].Value = GetSave[i]
print(i,Stats.Name,Stats.Value)
end
else
local StatsToSave = {}
for i,Stats in pairs(newStatsfolder:GetChildren())do
table.insert(StatsToSave,Stats.Value)
print(i,Stats.Name,Stats.Value)
end
datastore:SetAsync(key, StatsToSave)
end
while wait(30) do
local StatsToSave = {}
for i,Stats in pairs(newStatsfolder:GetChildren())do
table.insert(StatsToSave,Stats.Value)
print(i,Stats.Name,Stats.Value)
end
datastore:SetAsync(key,StatsToSave)
end
game.Players.PlayerRemoving:Connect(function(oldplayer)
local key = "Player-ID:"..oldplayer.UserId
local StatsToSave = {}
for i,Stats in pairs(newStatsfolder:GetChildren())do
table.insert(StatsToSave,Stats.Value)
print(i,Stats.Name,Stats.Value)
end
datastore:SetAsync(key,StatsToSave)
end)
end)
this is the script and its working but it can't be sent to my other place
script.Parent.MouseButton1Click:Connect(function()
game:GetService("TeleportService"):Teleport(2805605031,game.Players.LocalPlayer)
end)
and here is my teleportservice script and i dont know what to add

22 comments
How are you trying to pass it? Are the places within the same game?
Yes it is
Show the script and any errors
i cant comment it
Just edit your question
i dont know im just new in here sorry
Does the datastore not work at all? Or just not work in all of the places. The more information you give the less questions you need to answer.
data store is working but if i teleport to my other place same with the place with data store its not working only work in primary place
Is your datastore script identical for both places or are they different?
i dont know but my datastore is only in my primary place i did not put it to other place
Oh well thats the issue. You have to load the players data in from the seperate places, its not done automatically.
yes that's the issue but i dont know where to find information about doing data transfer to other place so i thought its not possible
The datastore is shared between places under the same game, so you could essentially just trasnfer the same script over and it should be fine.
do i need to copy the datastore script to other place? is that what you mean?
Thats right. If you dont tell the place to load/save the data it wont.
ok thanks i'll try it
Yes It's Possible Only You Need To Do Is Simple Like If The Data Are Leaderboards Only Go To Game Explorer Places And press right click Then You Can Make A New Game On There So Do It Copy And Paste The Another Game And Put The Datastore In That Game, And It's Done.
its not working they have different data but same script.i try some experiment and add points giver and if i touch that part i will get 100 points and then i try test it and i have 100 point in primary place and when i teleport to other place its still 0 so that means they have different data but its same script
How are you giving the player points? With a local script?
he have all the same data check this the same datastore need to be for it works.
no im giving player points using touched event in part
You REALLY need to rethink the logic behind this. PlayerRemoving and your while-loop should not be inside the PlayerAdded. Review DataStores some more too.