I want to make a leveling up system and the EXP script won't work. The script is when you get to 50 EXP you level up. It adds 50 more EXP every level... This is what I have in workspace:
function onPlayerEntered(newPlayer)
wait(.5)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local cash = Instance.new("IntValue")
cash.Name = "Level"
cash.Value = 1 --This sets the Level every player starts with
cash.Parent = stats
stats.Parent = newPlayer
local cash = Instance.new("IntValue")
cash.Name = "EXP"
cash.Value = 0 --This sets the amount of XP every player starts with
cash.Parent = stats
stats.Parent = newPlayer
local cash = Instance.new("IntValue")
cash.Name = "Money"
cash.Value = 100 --This sets the amount of Money every player starts with
cash.Parent = stats
stats.Parent = newPlayer
end
game.Players.ChildAdded:connect(onPlayerEntered)
This is a separate script that I have in workspace:
function onPlayerEntered(newPlayer) --When a player enters
L = newPlayer.stats.Level
e = newPlayer.stats.EXP
scr = script:clone() --Clones the script so you can give this to EVERYONE
scr.Parent = newPlayer --Makes the cloned script's parent the newPlayer
function checkXP() --name of the function
if e.Value >= 50*L.Value then --if the EXP value is greater than or equal to 50 TIMES the player's level then.
L.Value = L.Value+ 1 --Increase a Level
e.Value = 0 --Reset XP value to 0
end --end the if statement
end --end the function
e.Changed:connect(checkXP) --conneciton for checkXP function
end --end the onPlayerEntered function
game.Players.ChildAdded:connect(onPlayerEntered) --connection for onPlayerEntered function
Please Help...

4 comments
sorry it gliched
Please close your entire code between the two tilde bars(~~~) so we can better help you! :D
Yes, above with what Antonio said, please format your code with a Code Block (The Lua button).
Sorry about that.