So i have this teleporter to another 'place'. When I teleport there in roblox studio, the stats are saved and show. But when im in the game, no stats are showing in the 'place' at all. any fix?
Heres the teleport script
local TeleportService = game:GetService("TeleportService")
local placeID_1 = 4615108392
local placeID_2 = 4583065753
local function onPartTouch(otherPart)
local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
if player then
TeleportService:Teleport(placeID_1, player)
end
end
script.Parent.Touched:Connect(onPartTouch)
Here is the script in the place itself to load stats
local ds = game:GetService("DataStoreService"):GetDataStore("--Cash01")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
if game.Workspace:WaitForChild(player.Name) then
local key = "cash-"..player.userId
local folder = Instance.new("Folder",player)
folder.Name = "leaderstats" -- Must be lowercase
local currency = Instance.new("IntValue",folder)
currency.Name = "Cash"
currency.Value = 0
local save = ds:GetAsync(key)
if save then
currency.Value = save
end
currency.Changed:Connect(function()
ds:SetAsync(key,currency.Value)
end)
end
end)
end)
When I play it in roblox studio the stats show and save. but when i teleport to it it doesnt show stats.
