so, i have been trying to make a simulator in roblox by watching alvinblox's vid, and i typed half of the script (not fully done with the script) and he said for me i am supposed to test it to see if the dataStore works or not but when i test it in studio it doesnt work (leaderstats works in studio) but when i test in the main game the leaderstats doesnt work plus i see no error in the console.
Script:
local serverStorage = game:GetService("ServerStorage") local DataStore = game:GetService("DataStoreService"):GetDataStore("PlayerSave3")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player
local strength = Instance.new("NumberValue") strength.Name = "Strength" strength.Parent = leaderstats
local rebirths = Instance.new("IntValue") rebirths.Name = "Rebirths" rebirths.Parent = leaderstats
local dataFolder = Instance.new("Folder") dataFolder.Name = player.Name dataFolder.Parent = serverStorage.RemoteData
local debounce = Instance.new("BoolValue") debounce.Name = "Debounce" debounce.Parent = dataFolder
local strengthData, rebirthsData
local success,errormessage = pcall(function() strengthData = DataStore:GetAsync("strength-"..player.UserId) rebirthsData = DataStore:GetAsync("rebirths-"..player.UserId) end)
if success then if strengthData then strength.Value = strengthData rebirths.Value = rebirthsData end
end
end)
game.Players.PlayerRemoving:Connect(function(player) local success, errormessage = pcall(function() DataStore:SetAsync("strength-"..player.UserId,player.leaderstats.Strength.Value) DataStore:SetAsync("rebirths-"..player.UserId,player.leaderstats.Rebirths.Value) end) end)

4 comments
can you please put your code in a code box?
i am new here, how do i do that?
look at evaera's test question
https://scriptinghelpers.org/questions/77345/is-this-a-test-question-i-think-it-is-a-test-question