Results in an end/end) error as similar to before?
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local leaderstats = player:WaitForChild("leaderstats")
local EXP = leaderstats.EXP.Value
local LV = leaderstats.LV.Value
leaderstats.EXP:GetPropertyChangedSignal("Value"):Connect(function()
if LV <=10 then
if EXP >=LV * LV * 100 + 400 then
LV = ((EXP -400 )/100)^.5
end
elseif LV > 10 and LV <=20 then
if EXP >= LV * LV * 150 + 400 then
LV = ((EXP -400 )/150)^.5
end
elseif LV > 20 and LV <30 then
if EXP >=LV * LV * 200 + 400 then
LV = ((EXP -400 )/200)^.5
end
elseif LV >= 30 and LV <= 50 then
if EXP >= (LV^3 * 10) + 400 then
LV = LV + 1
end
elseif LV > 50 and LV <= 50 then
if EXP >= LV^3.6 then
LV = EXP^(1/3.6)
end
end
end)
Thought it might… Here is an updated version ↑
Results in no error but still doesn’t seem to give me a level up
Woops i missed a line of code:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local leaderstats = player:WaitForChild("leaderstats")
leaderstats.EXP:GetPropertyChangedSignal("Value"):Connect(function()
local EXP = leaderstats.EXP.Value
local LV = leaderstats.LV.Value
if LV <=10 then
if EXP >=LV * LV * 100 + 400 then
LV = ((EXP -400 )/100)^.5
end
elseif LV > 10 and LV <=20 then
if EXP >= LV * LV * 150 + 400 then
LV = ((EXP -400 )/150)^.5
end
elseif LV > 20 and LV <30 then
if EXP >=LV * LV * 200 + 400 then
LV = ((EXP -400 )/200)^.5
end
elseif LV >= 30 and LV <= 50 then
if EXP >= (LV^3 * 10) + 400 then
LV = LV + 1
end
elseif LV > 50 and LV <= 50 then
if EXP >= LV^3.6 then
LV = EXP^(1/3.6)
end
end
end)
Results in no error but still doesn’t level me up I think it might be the math? But it shouldn’t be…
https://gyazo.com/48cdc65fd8d7f68579b283acf26e5704
edit: For anyone coming here looking for a solution, the solution to the original post is here: Level script resulting in an end error? - #3 by PoppyandNeivaarecute
now try this code I guess:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local leaderstats = player:WaitForChild("leaderstats")
leaderstats.EXP:GetPropertyChangedSignal("Value"):Connect(function()
local EXP = leaderstats.EXP.Value
local LV = leaderstats.LV.Value
if LV <=10 then
if EXP >=LV * LV * 100 + 400 then
LV = ((EXP -400 )/100)^.5
end
elseif LV > 10 and LV <=20 then
if EXP >= LV * LV * 150 + 400 then
LV = ((EXP -400 )/150)^.5
end
elseif LV > 20 and LV <30 then
if EXP >=LV * LV * 200 + 400 then
LV = ((EXP -400 )/200)^.5
end
elseif LV >= 30 and LV <= 50 then
if EXP >= (LV^3 * 10) + 400 then
LV = LV + 1
end
elseif LV > 50 and LV <= 50 then
if EXP >= LV^3.6 then
LV = EXP^(1/3.6)
end
end
leaderstats.LV.Value = LV
end)
Last thing before going to sleep, so respond quickly pls xD
1 Like
Lol it works thank you! Thanks for the great help