My leaderstats script doesnt seem to work. I've changed it several times, but no matter what I do, it won't work. If anyone can help me here it is:
local nshow = {"attack","strength","defense","fishing","smithing","fletching","cooking", "woodcutting","crafting","theiving","prayer","farming"} --Different non-showing skills --Load Data game.Players.PlayerAdded:connect(function(player) player:WaitForDataReady() --Leaderstats leaderstats.Parent = game.Players:FindFirstChild(player) leaderstats.Name = "leaderstats" Level = Instance.new("IntValue") Level.Parent = leaderstats Gold = Instance.new("IntValue") Gold.Parent = leaderstats Skill = Instance.new("IntValue") Skill.Parent = leaderstats Gold.Name = "Gold" Level.Name = "Gold" Skill.Name = "Skill" if not pcall(function() Skill.Value = player:LoadNumber("Skill") end) then Skill.Value = 0 end if not pcall(function() Gold.Value = player:LoadNumber("Gold") end) then Gold.Value = 0 end if not pcall(function() Level.Value = player:LoadNumber("Level") end) then Level.Value = 1 end --stats local stats = Instance.new("Configuration", player) stats.Name = "stats" for _, stat in pairs(nshow) do stata = Instance.new("IntConstrainedValue", stats) stata.Name = stat stata.MinValue = 1 stata.MaxValue = 99 if not pcall(function() stata.Value = player:LoadNumber(stat.Name) end) then stata.Value = 0 end Instance.new("IntValue",stata).Name = "xp" if not pcall(function() stat.Value = player:LoadNumber(stat.Name.."xp") end) then stat.Value = 0 end Instance.new("IntValue",stata).Name = "nxp" end end) --Save Data game.Players.PlayerRemoving:connect(function(player) player:WaitForDataReady() for i,e in pairs(nshow) do player:SaveNumber(e.Name,player.stats:FindFirstChild(e).Value) player:SaveNumber(e.Name.."xp",player.stats:FindFirstChild(e).xp.Value) end player:SaveNumber("Skill",Skill.Value) player:SaveNumber("Gold",Gold.Value) player:SaveNumber("Level",Level.Value) end)
player:WaitForDataReady() --Leaderstats leaderstats = Instance.new("IntValue", player) leaderstats.Name = "leaderstats"
Instance's 'new' method takes a second parameters, which is what you want to set the parent of what you just created to.
Also, 'player' points to the actual Player object; it isn't a string value.