I trying to get Stats and i have Error
Error - Infinite yield possible on 'Players:WaitForChild("Stats")'
local Data = game:GetService("DataStoreService"):GetDataStore("Shop")
game.Players.PlayerAdded:Connect(function(plr) local s = Instance.new("Folder",plr) s.Name = "Stats"
local cash = Instance.new("NumberValue",s) cash.Name = "Cash" cash.Value = "0" local multi = Instance.new("NumberValue",s) multi.Name = "Multiplier" multi.Value = "1" local rebirth = Instance.new("NumberValue",s) rebirth.Name = "Rebirth" rebirth.Value = "0" local dataload = Data:GetAsync(tostring(plr.UserId)) if dataload then cash.Value = dataload[1] multi.Value = dataload[2] rebirth.Value = dataload[3] end while wait(0.6) do cash.Value = cash.Value + (1*multi.Value) end
end)
game.Players.PlayerRemoving:Connect(function(plr)
Data:SetAsync(tostring(plr.UserId), { plr.Stats.Cash.Value, plr.Stats.Multiplier.Value, plr.Stats.Rebirths.Value })
end)
Also output says me - Rebirths is not a valid member of Folder "Players.Dima_Games666.Stats"
local Data = game:GetService("DataStoreService"):GetDataStore("Shop")
game.Players.PlayerAdded:Connect(function(plr) local s = Instance.new("Folder",plr) s.Name = "Stats"
local cash = Instance.new("NumberValue",s) cash.Name = "Cash" cash.Value = "0" local multi = Instance.new("NumberValue",s) multi.Name = "Multiplier" multi.Value = "1" local rebirth = Instance.new("NumberValue",s) rebirth.Name = "Rebirth" rebirth.Value = "0" local dataload = Data:GetAsync(tostring(plr.UserId)) if dataload then cash.Value = dataload[1] multi.Value = dataload[2] rebirth.Value = dataload[3] end while wait(0.6) do cash.Value = cash.Value + (1*multi.Value) end
end)
game.Players.PlayerRemoving:Connect(function(plr)
Data:SetAsync(tostring(plr.UserId), { plr.Stats.Cash.Value, plr.Stats.Multiplier.Value, plr.Stats.Rebirths.Value })
end)