So when you click a button then you get a tool in your backpack only if you have 15 levels in the leaderstats and it takes away 15 levels from you but instead it takes away like a lot of levels and it gives you a negative value here is my script:
script.Parent.ClickDetector.MouseClick:Connect(function(player) local playerLevel = player.leaderstats.Level playerLevel.Value = playerLevel.Value + 1
if playerLevel.Value >= 15 then local ReplicatedStorage = game:GetService("ReplicatedStorage") local ToolGiver = game.Workspace.ToolGiver local PartTool = game.ReplicatedStorage.PartTool ToolGiver.ClickDetector.MouseClick:Connect(function() PartTool:Clone() PartTool.Parent = player.Backpack playerLevel.Value = playerLevel.Value - 15 end) end
end)
Maybe change this:
ToolGiver.ClickDetector.MouseClick:Connect(function() PartTool:Clone() PartTool.Parent = player.Backpack playerLevel.Value = playerLevel.Value - 15 end)
To this:
ToolGiver.ClickDetector.MouseClick:Connect(function() if playerLevel.Value >= 15 then PartTool:Clone() PartTool.Parent = player.Backpack playerLevel.Value = playerLevel.Value - 15 end end)
It should work.