I made this leaderstats script in workspace. I did exactly the same thing on what the tutorial said. But it says I have an error on line 14 saying: Attempt to call a field 'Value' (A string value) Here's the script:
lvlkey = "lv" rankkey = "rnk" game.Players.PlayerAdded:connect(function(player) local l = Instance.new("IntValue") l.Name = "leaderstats" local lv = Instance.new("IntValue", l) lv.Name = "Lvl" lv.Value = 1 local rnk = Instance.new("StringValue", l) rnk.Name = "Rank" rnk.Value "New" -- Error -- -- Loading -- player:WaitForDataReady() lv.Value = player:LoadNumber(lvlkey) rnk.Value = player:LoadString(rankkey) end) -- Auto saving -- game.Players.PlayerRemoving:connect(function(player) player:SaveNumber(lvlkey, player.leaderstats.Lvl.Value) player:SaveString(rankkey, player.leaderstats.Rank.Value) end)
you forgot to add an = sign if you wanted the value to change to "New"
so you should replace it with this. you should always check for simple errors like this before posting to this site, as a load of errors are caused by simple typing errors
rnk.Value = "New"