At first my ends worked perfectly and suddenly they broke. It is in a regular script. Here is my script(it's from an AlvinBlox tutorial bc i suck at stats):
local serverStorage = game:GetService("ServerStorage") local DataStore = game:GetService("DataStoreService"):GetDataStore("PlayerSaveData") 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) 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.Strength.Value) end) end)
Hey!
Try this. I added two ends one with a ) and one without it.
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 strength.Value = strengthData rebirths.Value = rebirthsData end end)