when i test play on Roblox studio, the log says this : Multiplier is not a valid member of Folder Stack Begin Script 'ServerScriptService.Stats', Line 21 Stack End And also the multiplier value does not show up in leaderstats
local DataStoreService = game:GetService("DataStoreService") local DataStore = DataStoreService:GetDataStore("Clidat") game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Parent = player leaderstats.Name = "leaderstats" local Clicks = Instance.new("IntValue", leaderstats) Clicks.Name = "Clicks" Clicks.Value = DataStore:GetAsync(player.UserId) or 0 local mult = Instance.new("IntValue", leaderstats) mult.Name = "Multiplier" mult.Value = DataStore:GetAsync(player.UserId) or 1 end) game.Players.PlayerRemoving:Connect(function(player) local Clicks = player.leaderstats.Clicks local mult = player.leaderstats.Multiplier local dattosa = { Clicks.Value mult.Value } DataStore:SetAsync(player.UserId, dattosa) end)
You need to add a comma to your dattosa table.
local DataStoreService = game:GetService("DataStoreService") local DataStore = DataStoreService:GetDataStore("Clidat") game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Parent = player leaderstats.Name = "leaderstats" local Clicks = Instance.new("IntValue", leaderstats) Clicks.Name = "Clicks" Clicks.Value = DataStore:GetAsync(player.UserId) or 0 local mult = Instance.new("IntValue", leaderstats) mult.Name = "Multiplier" mult.Value = DataStore:GetAsync(player.UserId) or 1 end) game.Players.PlayerRemoving:Connect(function(player) local Clicks = player.leaderstats.Clicks local mult = player.leaderstats.Multiplier local dattosa = { Clicks.Value, mult.Value } DataStore:SetAsync(player.UserId, dattosa) end)