I am currently making this game, and I have a 'Place' added into it. So you spawn in the game and when you touch a "Part" you teleport to the "Place". In studio the leaderstats transfer over and everything. But in the actual game it doesn't, Im using PlayerAdded, since the player isn't really "Added", is that why it doesn't work in Roblox itself?
Teleport Script --
local TPService = game:GetService("TeleportService")
local id1 = 4615108392
local function onPartTouch(otherPart)
local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
if player then
TPService :Teleport(id1,player)
end
end
script.Parent.Touched:Connect(onPartTouch)
Leaderstat script (Which I Use the same DataStore in the "Place" so it transfers fine in Studio but in Roblox, It doesn't even show the leaderstats names..
local ds = game:GetService("DataStoreService"):GetDataStore("LBSaver")
game.Players.PlayerAdded:Connect(function(player)
local key = "cash-"..player.userId
local folder = Instance.new("Folder",player)
folder.Name = "leaderstats"
local currency = Instance.new("IntValue",folder)
currency.Name = "Cash"
currency.Value = 0
local saved = ds:GetAsync(key)
if saved then
currency.Value = saved
end
currency.Changed:Connect(function()
ds:SetAsync(key,currency.Value)
end)
end)
Thanks
