function UpdateAttributes()(script.Parent:WaitForChild("\080\111\105\110\116\115")).Text="\080\111\105\110\116\115\058 "..players.LocalPlayer.Stats.Points.Value for r,B in pairs(attributes:GetChildren())do if B.ClassName=="\070\114\097\109\101"then local r=replicatedStorage.ServerSettings:FindFirstChild(B.Name.."\067\097\112")local p=players.LocalPlayer.Attributes:FindFirstChild(B.Name)local y=1 if r and p then y=p.Value/r.Value end B.Bar.Fill.Position=UDim2.new(y-1,0,0,0)B.Title.Text=B.Name..(" \040"..(p.Value.."\041"))end end end;(script.Parent:WaitForChild("\082\101\115\101\116")).MouseButton1Click:Connect(function()(require(playSoundEffect))("\085\110\101\113\117\105\112")workspace.Remotes.ResetPoints:InvokeServer()UpdateAttributes()end);(script.Parent:WaitForChild("\067\108\111\115\101")).MouseButton1Click:Connect(function()(require(switchMenu))(true)end);(script.Parent:GetPropertyChangedSignal("\086\105\115\105\098\108\101")):Connect(function()if script.Parent.Visible==true then UpdateAttributes()end end)for r,B in pairs(attributes:GetChildren())do if B.ClassName=="\070\114\097\109\101"then(B:WaitForChild("\065\100\100")).MouseButton1Click:Connect(function()local r=workspace.Remotes.UsePointForAttribute:InvokeServer(B.Name)if r then(require(playSoundEffect))("\069\113\117\105\112")UpdateAttributes()end end)end end
-- The names of the frames in the Attribute frame correspond to stat names

function UpdateAttributes()
	script.Parent:WaitForChild("Points").Text = "Points: " .. players.LocalPlayer.Stats.Points.Value
	for _, attribute in pairs(attributes:GetChildren()) do
		if attribute.ClassName == "Frame" then
			local cap = replicatedStorage.ServerSettings:FindFirstChild(attribute.Name .. "Cap")
			local stat = players.LocalPlayer.Attributes:FindFirstChild(attribute.Name)
			local percentage = 1
			if cap and stat then
				percentage = stat.Value / cap.Value
			end
			attribute.Bar.Fill.Position = UDim2.new(percentage - 1, 0, 0, 0)
			attribute.Title.Text = attribute.Name .. " (" .. stat.Value .. ")"
		end
	end
end

script.Parent:WaitForChild("Reset").MouseButton1Click:Connect(function()
	require(playSoundEffect)("Unequip")
	workspace.Remotes.ResetPoints:InvokeServer()
	UpdateAttributes()
end)

script.Parent:WaitForChild("Close").MouseButton1Click:Connect(function()
	require(switchMenu)(true)
end)

script.Parent:GetPropertyChangedSignal("Visible"):Connect(function()
	if script.Parent.Visible == true then
		UpdateAttributes()
	end
end)

for _, attribute in pairs(attributes:GetChildren()) do
	if attribute.ClassName == "Frame" then
		attribute:WaitForChild("Add").MouseButton1Click:Connect(function()
			local success = workspace.Remotes.UsePointForAttribute:InvokeServer(attribute.Name)
			if success then
				require(playSoundEffect)("Equip")
				UpdateAttributes()
			end
		end)
	end
end
