while wait() do

local plyrxpNeeded = ((plyrLevel.Value^2)*5)

if plyrXP.Value >= plyrxpNeeded then
    plyrLevel.Value = plyrLevel.Value + 1
    
    LvlUpGui.GuiFrame.Visible = true

	for _, statButton in pairs(LvlUpGui:GetDescendants()) do
		if statButton:IsA("TextButton") then
			statButton.MouseButton1Down:Connect(function()
				plyrAtr[statButton.Name].Value = plyrAtr[statButton.Name].Value + 5
				LvlUpGui.GuiFrame.Visible = false
			end)
		end
	end
end

end

That is basically the part of the code I'm having trouble with - if I leave the LvlUpGui visible and click the button, it works adding +5 every time to the player amount, but if I set it to be false again whenever I level up it goes +5 (105), +10 (115), +15 (130), etc

2 comments

0

Move all your stuff below 'LvlUpGui.GuiFrame.Visible = true' above the while wait() do.

0

Thanks @9mze :) Why does that break it?