function OnLevelUP(xp,nxp,mgrass,rank,cash)
if xp.Value >= nxp.Value then
mgrass = mgrass +5
rank = rank +1
cash = cash +20 +rank.Value+20
nxp = nxp +20
end end
(game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderborad"
leaderstats.Parent = player
local grass = Instance.new("IntValue")
grass.Name = "Grass"
grass.Value = 0
grass.Parent = leaderstats
local mgrass = Instance.new("IntValue")
mgrass.Name = "MaxGrass"
mgrass.Value = 20
mgrass.Parent = leaderstats
local money = Instance.new("IntValue")
money.Name = "Cash"
money.Value = 10
money.Parent = leaderstats
local xp = Instance.new("IntValue")
xp.Name = "XP"
xp.Value = 21
xp.Parent = leaderstats
local nxp = Instance.new("IntValue")
nxp.Name = "NXP"
nxp.Value = 20
nxp.Parent = leaderstats
local rank = Instance.new("IntValue")
rank.Name = "Rank"
rank.Value = 1
rank.Parent = leaderstats
xp.Changed:connect(function()OnLevelUP(xp,nxp,mgrass,rank,cash)
end)end
Here a Error Script

4 comments
you're suppose to name it "leaderstats"
also :connect() is deprecated, use :Connect() and use local functions
also add more white space to ur code
you forgot all the .Values in OnLevelUP