What do you want to achieve? For example, we have 11 points and when pressed, if a person has more than 10 points, he takes away 10 points and gives “XP” 5 if we have, for example, 6 Then when pressed, he minus 5 XP and gives “1 Level” we have 1 Xp left
What is the issue? The problem is that it “Resets” everything When you click on “Part” it gives 1 But the level is saved
local Part26=script.Parent
local clickDetector=Part26.ClickDetector
clickDetector.MouseClick:Connect(function(player)
local XP = player.leaderstats.XP
local PlayerPoind = player.leaderstats.Points
PlayerPoind = 1
local level = player.leaderstats.level
if PlayerPoind.Value >= 10 then
PlayerPoind.Value = PlayerPoind.Value - 10
XP.Value = XP.Value + 5
if XP.Value >=5 then
XP.Value = XP.Value - 5
wait(0.1)
level.Value = 1
end
end
end)
What solutions have you tried so far? Searched but didn’t find
local XP = player.leaderstats.XP
if PlayerPoind.Value >=6 then
PlayerPoind.Value -= 3
XP.Value = XP.Value + 2
if XP.Value >=6 then
XP.Value -=5
wait(1)
level.Value = level.Value + 1
end
end
end
end)