The script is:
local DataStore = game:GetService("DataStoreService") local Level1 = DataStore:GetDataStore("Levels001") local Beli11 = DataStore:GetDataStore("Beli001") local Exp1 = DataStore:GetDataStore("Exp001") local ExpNeed1 = DataStore:GetDataStore("ExpNeed001") game.Players.PlayerAdded:Connect(function(Plr) local stats = Instance.new("Folder", Plr) stats.Name = "Data" --- Level System local Levels = Instance.new("IntValue", stats) Levels.Name = "Levels" Levels.Value = 1 local Exp = Instance.new("IntValue", stats) Exp.Name = "Exp" Exp.Value = 0 local ExpNeed = Instance.new("IntValue", stats) ExpNeed.Name = "ExpNeed" ExpNeed.Value = 200 --- Money System local Beli = Instance.new("IntValue", stats) Beli.Name = "Gold" Beli.Value = 0 --- Stats Text ---- Datastore ---- --- Levels Levels.Value = Level1:GetAsync(Plr.UserId) or Levels.Value Level1:SetAsync(Plr.UserId, Levels.Value) Levels.Changed:connect(function() Level1:SetAsync(Plr.UserId, Levels.Value) end) --- Gold Beli.Value = Beli11:GetAsync(Plr.UserId) or Beli.Value Beli11:SetAsync(Plr.UserId, Beli.Value) Beli.Changed:connect(function() Beli11:SetAsync(Plr.UserId, Beli.Value) end) --- Exp Exp.Value = Exp1:GetAsync(Plr.UserId) or Exp.Value Exp1:SetAsync(Plr.UserId, Exp.Value) Exp.Changed:connect(function() Exp1:SetAsync(Plr.UserId, Exp.Value) end) --- ExpNeed ExpNeed.Value = ExpNeed1:GetAsync(Plr.UserId) or ExpNeed.Value ExpNeed1:SetAsync(Plr.UserId, ExpNeed.Value) ExpNeed.Changed:connect(function() ExpNeed1:SetAsync(Plr.UserId, ExpNeed.Value) end) end) game.Players.PlayerAdded:Connect(function(plr) wait(.1) local Exp = plr.Data.Exp local Levels = plr.Data.Levels local ExpNeed = plr.Data.ExpNeed while wait() do if Exp.Value >= (100 * (Levels.Value + 1)) and Levels.Value <= 399 then Levels.Value = Levels.Value + 1 Exp.Value = Exp.Value - ExpNeed.Value ExpNeed.Value = ExpNeed.Value + 100 game.ReplicatedStorage.LevelSystem.LevelUpGui:FireClient(plr) end end end) game.Players.PlayerRemoving:connect(function(Player) Level1:SetAsync(Player.UserId, Player.Data.Levels.Value) Beli11:SetAsync(Player.UserId, Player.Data.Beli.Value) Exp1:SetAsync(Player.UserId, Player.Data.Exp.Value) ExpNeed1:SetAsync(Player.UserId, Player.Data.ExpNeed.Value) end)
The error i i recieve is:
22:29:42.666 - Beli is not a valid member of Folder
22:29:42.667 - Stack Begin
22:29:42.667 - Script 'ServerScriptService.Data', Line 75
22:29:42.667 - Stack End
It prompts me the error as its closing out of the game.
Im confused as to what is causing this, and a hint in the right direction would be a great help.
Your “Beli” instance is actually named Gold and not Beli when you try to call it.
Quick Tip: You shouldn’t use the player parameter in Instance.new as it is known to cause issues.