So I expected this script :
humanoid = game.Players.LocalPlayer.Character.Humanoid level = game.Players.LocalPlayer.leaderstats.Level humanoid.MaxHealth = 100 + (level * 2)
to set my health to 102 (because my level is 1) but it gives me this error : leaderstats is not a valid member of Player What's wrong? leaderstats script
local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local level1 = Instance.new("IntValue") level1.Name = "Level" level1.Value = level:GetAsync(key) level1.Parent = leaderstats local gold1 = Instance.new("IntValue") gold1.Name = "Gold" gold1.Value = gold:GetAsync(key) gold1.Parent = leaderstats
That isn't the whole thing, but I think that'll help out
You have 2 errors in your script (possibly a third). 1. You didn't properly create the leaderstats "folder" and you were trying to multiply a userdata value.
Fix
For the leaderboard on Line 1 you create a folder to hold your leaderstats, you need to change that to an IntValue. Also, you haven't put in a PlayerAdded function to create the leaderboard. (Not sure if that's the thing you removed like you said.)
Now, for your other script that changes the max health. On Line 2 you forgot to put a .Value, so on Line 4 you are trying to multiply the word "Level".
Final Scripts:
The health script:
humanoid = game.Players.LocalPlayer.Character.Humanoid level = game.Players.LocalPlayer.leaderstats.Level.Value humanoid.MaxHealth = 100 + (level * 2)
The leaderboard script:
function onPlayerAdded(player) local leaderstats = Instance.new("IntValue") leaderstats.Name = "leaderstats" leaderstats.Parent = player local level1 = Instance.new("IntValue") level1.Name = "Level" level1.Value = level:GetAsync(key) level1.Parent = leaderstats local gold1 = Instance.new("IntValue") gold1.Name = "Gold" gold1.Value = 0 gold1.Parent = leaderstats end game.Players.PlayerAdded:connect(onPlayerAdded)
If you thought this was helpful make sure to up vote and accept this answer. :)
Can you paste the leaderboard script?