Basically, the text instead of showing the actual requirement, it just begins going into the negatives and acting all weird.
I’m confused and not sure why this is happening
Text label script:
local player = game.Players.LocalPlayer
script.Parent.Text = "Exp required to level up: ".. player:WaitForChild("Levels"):WaitForChild("Requirement").Value - player:WaitForChild("Requirement"):WaitForChild("Exp").Value
player.Requirement.Exp.Changed:Connect(function()
script.Parent.Text = "Exp required to level up: ".. player:WaitForChild("Levels"):WaitForChild("Requirement").Value - player:WaitForChild("Requirement"):WaitForChild("Exp").Value
end)
Server script:
game.Players.PlayerAdded:Connect(function(plr)
local Requirement = plr:WaitForChild("Levels"):WaitForChild("Requirement").Value
local level = plr:WaitForChild("Levels"):WaitForChild("Level")
local exp = plr:WaitForChild("Requirement"):WaitForChild("Exp")
Requirement = level.Value * 25
if exp.Value >= Requirement then
Requirement = level.Value * 25
exp.Value = 0
level.Value +=1
end
exp.Changed:Connect(function()
if exp.Value >= Requirement then
Requirement = level.Value * 25
exp.Value = 0
level.Value +=1
end
end)
end)
Server script works fine, though I think it’d be better to show you that as well
Use “math.abs()”, this turns minus to plus numbers.
Also, “WaitForChild()” should be used not more than once in a sentence. In some cases not more than one line
So your TextLabel script should be:
local player = game.Players.LocalPlayer
local levels = player:WaitForChild(“Levels”)
local requirement = player.Requirement
local gap = math.abs( levels.Requirement.Value - requirement.Exp.Value)
script.Parent.Text = "Exp required to level up: "…gap
player.Requirement.Exp.Changed:Connect(function()
gap = math.abs( levels.Requirement.Value - requirement.Exp.Value)
script.Parent.Text = "Exp required to level up: "…gap
But now instead, the exp required just begins going up instead of going down when I get exp.
Also I don’t think it solves the problem, it still won’t give an accurate value.
Still experiencing the same problem.
Did I implement it correctly:
local player = game.Players.LocalPlayer
local levels = player:WaitForChild("Levels")
local requirement = player.Requirement
local gap = math.ceil(math.abs( requirement.Exp.Value - levels.Requirement.Value))
script.Parent.Text = "Exp required to level up: ".. gap
player.Requirement.Exp.Changed:Connect(function()
gap = math.ceil(math.abs( requirement.Exp.Value - levels.Requirement.Value))
script.Parent.Text = "Exp required to level up: ".. gap
end)